Scala in Depth: Review

First of all, I would like to thank Manning Publications for providing me a copy of “Scala in Depth”. To keep the promise I present you my personal review which is, at the same time, an opening post for my blog.

Although Scala has been present in the world of programming for quite a long time (~8 years), it is last two years when its popularity has grown extremely rapidly. Recently most Java conferences offered  great talks about it, lots of developers got interested (including me) but there was one major inconvenience: insufficiency of fresh books describing the deep details of language features. There are, of  course, lots of blogs and tutorials presenting Scala with examples. There are also a few decent books (listed on scala-lang official website), but most of them intend only to introduce the language and present its standard appliances. What I have been waiting for impatiently was a descriptive book about advanced features of Scala with additional explanations of mechanism that “just worked” so far.

I must admit that “Scala in Depth” definitely exceeded my expectations. Joshua D. Suereth took the word “Depth” really seriously and prepared a very comprehensive reference of different advanced  aspects of Scala. The book is written in a consistent and expressive form. All the chapters are well structured, describing exactly what they should. The set of selected subjects fits well, nothing is missing or neglected, nothing is forced or unnecessary. Everything right where it belongs. Additionally, there are many examples of bytecode output emitted by the compiler, so even the most inquisitive developers should be fully satisfied.

First four chapters are a strong reference of best patterns and rules for developers who think of building some production code with Scala. It is a decent set of hints and practices to avoid habits from other languages and grip a better understanding of language principles. The most important concepts including functional style (functions, expressions, immutability), Option type, coding conventions and many others are well described to to warm you up before pretty heavy content in the following chapters.

Next three chapters (5, 6, 7) explore the subjects of Scala type system and implicits with surgical precision. I wouldn’t call it shame when I confess that it was very difficult to grab all these details and understand them without confusion. However, I cannot blame the book for being vague or chaotic, the explanations are very well structured and descriptive, the only problem was that I never expected the world of implicits and Scala type system to be so rich. If I should point any flaw, it might be probably the selection of examples. The low-level nature of all advanced appliances suggest that there are not so many “day to day” problems which can be solved with these techniques. They seem to be very well tailored for building frameworks or DSLs, but this subject was clearly covered in “DSLs in Action”, which I recommend as a must for any Scala fan (or, actually, any software developer who doesn’t want to be  a subject of future version of COBOL jokes). I believe that I will go back to check chapters 5, 6 and 7 many more times before I get really comfortable with these subjects, it’s good to have such a precise reference though.

Chapter eight brings a moment’s grace, as the matter of collections is a pretty standard and familiar one after reading any previous Scala book. Fortunately, the author  found many interesting additional aspects, like mixin synchronization, views or paralell collections, which keeps reader’s focus sharp in order to stay on track. I find this particular chapter a little bit too short, maybe it could be enriched with some more examples in future editions.

Twenty pages about Actors may also seem a little disappointing, but in my opinion chapter 9 shouldn’t be any longer. It extends all the introductory information which can be found in other books. Handling failures and scheduling  are sufficiently advanced for most cases, and the chapter ends exactly in a point where the reader realizes that actors and Akka deserve their whole separate book.

Chapter ten settles with the myth that integrating Java and Scala is a piece of cake. There are various nuances that need to be discussed and the author did a perfect job bringing them all out. This chapter explains well what are the best ways to create Java code for integration with Scala, providing a portion of bytecode compiler output for anyone who would doubt in given suggestions. There are also pretty good descriptions of appliances of Scala implicits to integrate with Java with maximum comfort. Chapter ten also deals with some cumbersome topics like serialization or annotations which complete a very decent list of Java/Scala integration issues.

A yummy cake wouldn’t be complete without a cherry on its top, which is the last chapter: “Patterns in functional programming”. As chapters 5, 6 and 7, this one requires maximum focus, let “Monads” be the word to prove that. By the way, Manning announces a new title: “Functional Programming in Scala” planned for release around spring 2013. I think that chapter 11 may serve as an introduction to this whole new purely functional world, but currently I could not get fascinated by it. This  is the point where I want to remind the main flaw of this book, which is, again, lack of strong and palpable examples. Or maybe my spirit is just not ready for  a new religion. Anyway, this chapter could be seen as pretty “hardcore” for Plain Old Object-Oriented Developers (like me) but it certainly does a decent job of discussing the fundamentals of functional patterns.

To sum up, “Scala in Depth” is currently absolutely the most detailed and comprehensive book about this exciting and promising language. Its appearance on the market suggests that Scala is becoming a serious player and that movement towards new paradigms is real.  If you need to get convinced that Scala is worth learning, spare it for later and check out some other titles first (for example, the somehow-still-in-MEAP “Scala in Action”). If you already know the basics of Scala and need answers for all the intriguing questions you have been gathering so far, you will be more than positively surprised.

Oh, and if you’re not convinced you might want to check out this other review: and substantial.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s