Programming Scala Book Review
With the advent of so many recent language constructs leveraging the Java Virtual Machine, Scala is getting more attention than others these days due to high profile websites like Twitter stating their intent to use this functional programming language to scale service offerings to higher levels. Does Programming Scala help Java developers quickly grasp what the language has to offer? Read on to find out.
Venkat Subramaniam is already an accomplished tech book author (including being co-author of the 2007 Jolt award-winning Practices of an Agile Developer), as well as a globe-trotting tech language trainer. As such, his books take a real-world, time-constrained approach to learning a language or concept as quickly and effectively as possible. Compared to other Scala books, Programming Scala is not nearly as thick and bulky, but it is densely packed with the necessary essentials. To keep the size and intimidation factor to a minimum, the author cuts straight to Scala's functional approach by opening the book with an annual top stock example. Rather than take a hand-holding, lethargic tactic of learning everything there is about Scala before writing such a brief demonstration application, Venkat asks the reader to patiently stay with him as he deconstructs the syntax and intent around Scala's terse instructions. Fortunately, the example is simple enough and the choice of syntax is easy enough to follow along without any disorientation.
The next several chapters review language basics like creating Scala classes and collections, function values and method patterns, traits and type conversions, pattern matching and regular expressions. Things get really interesting and meaningful in Chapter 10, Concurrent Programming. After all, this is what everyone is abuzz with in the Scala community. Immutability, the Actor class and actor method, receive/receiveWithin and react/reactWithin are all part of the thread abstractions that make Scala attractive to anyone who has had to deal with Java thread concurrency issues in the past. The remaining chapters on intermixing with Java, unit testing and exception handling help provide enough foundation for Chapter 14, the last chapter in the book. Here, the author steps through the creation of a Swing-based stock net asset Scala application featuring a majority of the syntax principles discussed in previous chapters. It nicely ties together all the attractive selling points of what makes the language a more pleasant coding experience, especially when compared to Java.
While the book did reignite my interest in Scala (my introduction to the language was judging the 2009 Jolt award-winning Programming in Scala: A Comprehensive Step-by-step Guide co-written by Scala's creator), it didn't address my questions of what application architects are giving up when using Scala, especially compared to the host of other multi-core friendly languages. Besides the well-publicized Twitter developer post of using the language, what other highly visible web properties are successfully using Scala and why did they choose it over Clojure, Erlang or some other solution concurrent-optimized approach? What kind of performance hit should I expect as Scala spins up? I noticed even for the small stock analysis program detailed in the book's final chapter took a very noticeable amount of time to execute the first time it was run thanks to first firing up a JVM followed by the Scala libraries needed to interpret the Scala scripts. Compiling down the scripts helped just a tad. I know the performance hit isn't nearly as significant for a preloaded web application, but I would like further assurances by an outside party that have bet their business on Scala's promises before considering it for my own software projects.
Regardless of this criticism, Programming Scala is a far easier and more immediate read than other reference-oriented Scala titles. The book gives just enough language details to get Java developers started with looking more deeply into Scala in action. Readers will also understand why Scala is so attractive, whether its because of its burden-relieving thread management capabilities, it's granting XML first-class status, its functional programming immutable object model and its significant reduction of Java syntax to do something as simple as printing out 'Hello, world" to the console. If you're not sure if Scala may fit your way of thinking but are interested in kicking the tires, Programming Scala provides a reasonably priced means to competently learn enough Scala syntax to seriously evaluate the language's merits and possibilities for your own software projects.
Title: Programming Scala
Author: Venkat Subramaniam
Publisher: Pragmatic Bookshelf
Price: $34.95 US