Odersky’s Scalable Component Abstractions is an absolute must read for anyone planning on mastering Scala. The paper explains the purpose and use of three important Scala idioms you’d probably take a long time to figure out on your own:
- Abstract Type Members. Prior to reading the paper, I figured abstract type members are just another way of expressing type parameters — that is, generic type params in Java. Not so! Abstract type members turn out to be an incredibly important way of promoting code re-use through subtype parameters.
- Traits. “Module mix-in components” is the term used in the paper, but in Scala this means traits. The paper explains how traits promote code re-use through much more flexible composition than Java’s interfaces+single base class.
- Explicit Selftypes. Not so mind expanding as abstract type members and traits, but definitely a concept that needs anchoring for someone coming from Java or similar OO languages.