September 2015
Intermediate to advanced
250 pages
6h 40m
English
In this chapter, we explored an interesting and powerful Scala feature that promotes extensibility. Traits are a great design tool to create extensible code with dynamic behavior beyond what’s provided by one single class. They nicely avoid method collisions when multiple implementations are brought together. You saw how powerful patterns like the Decorator pattern can be elegantly implemented with traits.
In the next chapter, we’ll take a look at Scala’s support for collections of objects.
Read now
Unlock full access