Tag Archives: Traits

Back2Basics: The Story of Trait – Part 3


In our previous blog The Story of Trait – Part 2, we have discussed that traits can have implementation too and how they behave under the hood. In this blog, we will discuss mixins one of the most charming features … Continue reading

Posted in Scala | Tagged , , , , , , , , , | 4 Comments

Back2Basics: The Story of Trait – Part 2


In our previous blog The Story of Trait – Part 1, we have discussed how traits are the just regular interfaces at the very basic form. In this blog, we will explore about traits can have method implementation too. We … Continue reading

Posted in Functional Programming, Scala | Tagged , , , , , , , , , | 8 Comments

Back2Basics: The Story of Trait – Part 1


In this blog, we will have a look at traits in Scala. We have classes in Scala. Suppose we have a class Dog which has a method speak. Now if we want another class Cat which has the same method … Continue reading

Posted in Functional Programming, Scala | Tagged , , , , , | 6 Comments

Scala Trait and Mixin – Points to Remember


Trait can be viewed not only as interfaces in other languages, but also as classes with only parameterless constructor. Whenever there is some code in trait, the trait is called mixin. trait Alarm { def trigger(): String } In scala … Continue reading

Posted in Best Practices, Functional Programming, Scala | Tagged , , , , , , , , , , , , , | 2 Comments

ScalaKnol: Understanding Traits as Stackable Modifications


Traits can be used to modify the methods of a class. The way such modifications are carried out is such that they can stack modifications with each other. Let us take an example. Say, there is a class called ImageProcessor … Continue reading

Posted in Scala | Tagged , , | Leave a comment

Scala Nuggets: Understanding Traits


Inphina provides specialized Scala consulting, training and offshoring … Learn more about Scala@Inphina! If you are coming from a Java background, then traits are interfaces++.  In scala, trait is a complete mixin solution where we can provide implementation in the … Continue reading

Posted in Scala | Tagged , , , | 1 Comment