In this part two of the series we’ll learn how to use traits to implement the decorator pattern. Decorator is a popular “GOF Pattern” that’s implemented well in the JDK IO API. Scala traits remove quite a bit of ceremony from the implementation of this pattern. In addition to the benefits of traits we saw in part 1 of this series, in this part we’ll see the advantages of applying multiple traits both at the class and instance level.
Dr. Venkat Subramaniam is an award-winning author, founder of Agile Developer, Inc., creator of agilelearner.com, and an instructional professor at the University of Houston.
He has trained and mentored thousands of software developers in the US, Canada, Europe, and Asia, and is a regularly-invited speaker at several international conferences. Venkat helps his clients effectively apply and succeed with sustainable agile practices on their software projects.
Venkat is a (co)author of multiple technical books, including the 2007 Jolt Productivity award winning book Practices of an Agile Developer. You can find a list of his books at agiledeveloper.com. You can reach him by email at email@example.com or on twitter at @venkat_s.