Channels ▼

Mike Riley

Dr. Dobb's Bloggers

Programming Scala Book Review

August 20, 2009

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
ISBN: 978-1-93435-631-9
Pages: 250
Price: $34.95 US

 

Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 


Video