Alex Staveley is a software professional passionate about software engineering and technical architecture. He blogs about architectural approaches, Java topics, web solutions and various technical bits and pieces. Alex is a DZone MVB and is not an employee of DZone and has posted 48 posts at DZone. You can read more from them at their website. View Full User Profile

Book Review: Beginning Scala (David Pollak)

04.26.2013
| 2969 views |
  • submit to reddit

Firstly, sorry it has been so long since last blog post.  Life is busy when you have two children.  I decided to try and learn Scala in 2013 and I am currently still pluggin' away.  This blog post is a review of David Pollack's Beginning Scala.

David Pollack has been writing software since 1977.  He wrote diagnostic software for the Commodore 64, the first real-time spreadsheet and founded the Lift Web Framework in 2007.   He describes his experience with Scala as an epiphany that changed the way he approach software; he certainly writes with enthusiasm and passion and in this book we even get a forward from the Godfather himself Martin Odersky.

'Beginning Scala' focusses very much on the core fundamentals of Scala.  The book in length is just under 300 pages. This is quite short in comparison to say Martin Odersky's excellent 'Programming in Scala' which is well over twice the length.  Where I see the sweet spot for Beginning Scala is for someone who wants to dip their toe into the water and is curious about the language feels and wants to get a good overview of the language quickly.  For more a detailed and substantial take on the language something like Odersky's book is necessary.

Areas covered include:
  • Scala traits and Scala's type system
  • Call-by-name
  • Scala collections and their immutable nature
  • Functional characteristics (passing functions, returning functions)
  • Pattern matching
  • Actors and concurrency
There are also some tips on how to introduce Scala to your team and some best practise advice.  My favourite parts were the explanation of Scala traits and the demonstration of the classic GoF Visitor Pattern made so simple using pattern matching (I'll cover this in a separate post). The one criticism I'd have is that I think what really sets Scala apart from Java is not that has lots of syntactic sugar but that it offers a functional programming approach.  This doesn't just mean you can pass functions to function, return them functions and so on but that you have to approach problems in a very different way.  In functional programming recursion is favoured over iteration.   There are many problems that developers could solve using iteration with one arm tied behind their back but to solve them using recursion is trickier.  One of Scala's features is that it facilitates both approaches but I think if you are going to embrace the functional paradigm properly you need to ditch iteration and embrace recursion.  This isn't really covered in the book - in fairness it is not really covered in detail Odersky's book either. However, if you look at the Scala course on coursera it is a massive massive massive massive massive massive massive massive part of it.
So overall, a very good book and well worth a dabble for someone that wants a dabble in Scala but if you want more you'll need more.

 

Published at DZone with permission of Alex Staveley, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)