ABOUT THIS BOOK xvii
Chapter 2 is a discussion of the core rules of Scala. These are the things that every
Scala developer should be aware of and make use of in daily development. This chap-
ter is for every Scala developer and covers the basics that make Scala a great language.
Chapter 3 is a digression in code style and associated issues. Scala brings a few new
players to the table, and any Scala style guide should reflect that. Some common con-
ventions from popular languages like Ruby and Java can actually be deterrents to
good Scala code.
Chapter 4 covers new issues arising in object-oriented design due to Scala’s mixin
inheritance. One topic of interest to any Scala developer is the early initializer cover-
age, which gets little coverage in other books.
After object orientation, the book moves into the implicit system. In chapter 5,
rather than simply discussing best practices, a deep dive is taken into the mechanics of
implicits in Scala. This chapter is a must for all Scala developers who wish to write
expressive libraries and code.
Chapter 6 is devoted to Scala’s type system. The discussion covers all the ways
types appear in Scala and how to utilize the type system to enforce constraints. The
chapter moves into a discussion of higher-kinded types and finishes with a dive into
existential types.
Chapter 7 discusses the most advanced usage patterns in the language, the inter-
section of types and implicits. This intersection is where a lot of interesting and power-
ful abstractions occur, the epitome of which is the type class pattern.
Having covered the most advanced aspects of Scala, in chapter 8 we move into a
discussion of Scala’s collection library. This includes the design and performance of
Scala’s collections as well as how to deal with the powerful type mechanisms.
Chapter 9 kicks off the discussion on actors in Scala. Actors are a concurrency
mechanism that can provide great throughput and parallelism when used appropri-
ately. The chapter dives into issues of designing actor-based systems and finishes with a
demonstration of how the Akka actors library provides best practices by default.
Chapter 10 covers Java integration with Scala. While Scala is more compatible with
Java than most other
JVM languages, there’s still a mismatch in features between the
two. It’s at these corners that issues arise in Scala-Java integration and this chapter pro-
vides a few simple rules that help avoid these issues.
Chapter 11 takes concepts from category theory and makes them practical. In pure
functional programming, a lot of concepts from category theory have been applied to
code. These are akin to object-oriented design patterns, but far more abstract. While
they have terrible names, as is common in mathematics, these concepts are immensely
useful in practice. No coverage of functional programming would be complete with-
out a discussion of some of these abstractions, and Scala in Depth does its best to
make these concepts real.
Code downloads and conventions
All source code in the book is in a
fixed-width
font
like
this
, which sets it off from
the surrounding text. In many listings, the code is annotated to point out the key