Thursday, June 7, 2012

Book review: Scala in Depth

I read Scala in Depth by Joshua D. Suereth over last week, which really is not giving it the time and attention it deserves. Furthermore I'm no Scala expert - although I'm not a complete novice either. Anyway here are my thoughts on the book.

Is it any good? Or TL;DR
Yes, it's good. It delivers on the promise of the title it is - as far as I can tell - really is Scala in depth. It does so with a mixture of some theoretical background for the different language constructs and a lot of practical Scala programming advice coming from the lessons the author has learned through his own use of the language. Where it sometimes lacks a bit is in introducing stuff before using it. This is not a problem if you have a basic working knowledge of Scala already, but I image it would be, if you didn't. Bottom line: I'd recommend Scala in Depth to anyone who - like me - has dipped their toes in Scala and want to learn more.

The language
The book starts off with a very quick introduction to the very basics of Scala - it's a statically blended OO/functional language with a very flexible syntax and grammar running on the JVM (and to some extent .NET if you really want). This introduction includes the REPL and a few tips like "prefer immutability". This should be enough to give you a feel for the language, and to get you startet playing in the REPL.
Once the basics are out of the way the book becomes somewhay more hard core - not in an academic language semantics kind of way, but in a practical way, where the reader through the book is taken through a number of sometimes hairy examples. These gives a thourough run through of the object oriented parts of the language (like classes, objects, traits and polymorphism), the type system (like generics, higher kinded types and existential types) and the functional parts (like functions, higher order functions, and some basic functional patterns).
All in all these parts of the book in themselves provide an in depth look at Scala. But not a very practical one: Knowing of the language features and even knowing the ins and outs of them is not the same as being able to use them well. These practicalities are addresed by the more style oriented parts of the book.

Style
The other part of the book - which is not pulled out as a separate part, but interleaved with the rest of the book - is the advice on style. To me these are the most interesting parts of the book. This where the book gets into things like demonstrating how to use actors effectively and safely, how to use implicits sanely, a map of the collections library and integrating with Java. These are things I suspect you'll need in real life development, and which are painful to go through learning by yourself.

All in all a very informative book that can take you from a basic knowledge of Scala to a thorough knowledge of the language - given that you take the time to do some serious coding along side your reading. If you just speed through the book - like I did - you'll learn less, but still a significant amount.

1 comment:

  1. This book is great, it includes some of the good examples in general as well as in deep. Lots of useful information which will be hard to find in any other resources.

    ReplyDelete