Programming with Scala Traits, Part Two

NFJS, the Magazine - September 2011

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.

An online version of this article is not available. This article is available in PDF, MOBI, and EPUB to those who have subscribed.

About Venkat Subramaniam

Venkat Subramaniam

Founder of Agile Developer, Inc.

Dr. Venkat Subramaniam is an award-winning author, founder of Agile Developer, Inc., creator of, 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 You can reach him by email at or on twitter at @venkat_s.

NFJS, the Magazine - September 2011

NFJS the Magazine - September 2011

In this Issue: