Books in Pairs: Programming in Scala vs. Programming Scala

Wednesday, December 15, 2010
File under: The Library

I’ve been using Scala for probably a year now, and I’m actually quite impressed with the language. In most languages, you sooner or later come across something which is just plainly broken. Everyone knows it is broken, but clearly, there is no way to do anything about it, so everyone uses one work-around or another. Surprisingly, although I’ve come close, all in all the language is really very well thought out and quite powerful and fun to use.

For those of you who don’t know: Scala is a language for the JVM (and apparently also for the .NET framework, although I haven’t tried that out yet). This means that the compiler produces normal Java byte code and therefore has access to the many existing Java libraries and projects. Other such languages are Clojure, JRuby, or Groovy. Scala is a statically typed language which sees itself as a synthesis of object oriented and functional programming. I’ve already sung the song of praise for Scala in another post.

Luckily, there are several good books available, of which I’ve read two this year:

  • Programming in Scala by Odersky, Spoon, and Venners (the guys who wrote Scala), artima.
  • Programming Scala by Wampler and Payne (who did some Scala programming for Twitter), O’Reilly.

Since the titles are so similar, I’ll just stick with the publishers for the rest of the review.

So which of the books should you buy to learn Scala? I’d say both.

The artima book is probably a bit more pure. It covers Scala in all its glory, focusing on different language features in every chapter. Martin Odersky is the creator of Scala, so his understanding of the language is thorough. I would probably go to the artima book first if I wanted to know everything about some obscure language feature.

On the other hand, while there is an extensive number of examples, they feel somewhat academic. Of course, many programming language books are like this, but while the authors make some effort to find relevant problems, I was often left with the feeling that something was missing. As we all know, development in the Java environment has it’s ugly places with all those imports, Maven project files, and so on. So if they build a spreadsheet with a few hundred lines of code (they do!), I couldn’t quite believe it.

This is where the O’Reilly book comes in. What I really liked about the book is how it is written for people who already have some professional background and doesn’t spare you all the nasty details. In the end, the book covers roughly the same scope as the artima book, but at the same time also gives convincing example why and how you would use certain features. I would probably go to the O’Reilly book first if I wanted to know how different language features interact and can be put to good use in practice.

So in summary, I can heartily recommend both. Depending on how you usually approach new programming languages you can pick one of the two books to start and later add the other book to fill in the missing pieces.

The O’Reilly book also covered new features in Scala 2.8, which the artima book didn’t, but I just learned that the second edition of the artima book is completed and will be available in printed form in January 2011.

Finally, the O’Reilly book can also be found online on the books homepage.

Posted by Mikio L. Braun at 2010-12-15 17:24:00 +0000

blog comments powered by Disqus