Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
Beginning Scala
Pollak D., Apress, Berkeley, CA, 2009. 350 pp. Type: Book (9781430219897)
Date Reviewed: Aug 25 2010

Can a book intended as a gateway drug to a programming language that took the author over 18 months to master achieve its goal? In this case, I fear not. If you are beginning Scala and are one of the “folks with some programming background” to whom the book is avowedly targeted, find some other resource--perhaps one of the many good online ones--to get started. Save this one until you've joined the club and can chuckle knowingly at the many breezy remarks that at times make the book seem like an extended inside joke, at Java's expense.

Don’t get me wrong: Pollak is a master of his material and is clearly extremely bright. His enthusiasm for Scala is evident; unfortunately, it is not contagious. Repeated examples of the form “Look, you can do this ... and you can do this ... and you can do this” might inspire a sense of wonder, but they do little to advance the understanding of a serious student of programming languages. Furthermore, repeated descriptions of code that to a novice might seem opaque as “syntactically pleasing” simply underscore the fact that one man’s pleasure is another man’s impenetrability.

A few concrete examples may give substance to these general observations.

Pollak states: “In Scala, the cons cell is represented by the :: case class. Perhaps you have just said, ‘Ah hah!’” Pity the poor reader who said “What?” instead of “Ah hah!”

We are told repeatedly that a Scala trait is like a Java interface, except that it may contain method invocations. The obvious question then is: How does it differ from a Java abstract class? You may look in vain for a simple answer to this question. The Java programmer who wonders how, if traits provide a diamond-problem-free form of multiple inheritance, they are implemented given the limitations of the Java Virtual Machine (JVM) will likewise be disappointed. The book’s index lacks entries for “inheritance,” “extension,” “supertrait,” and “with,” and the exact syntax for “extension” is never given; again, there are only examples of the “and look, you can do this” variety.

Is the jargonistic “desugar” such a commonly accepted term that it merits neither a definition nor an index entry? Surely not--at least not in the old, pre-Google world.

The chapter on concurrency begins with the following (paraphrased) argument: “synchronized is bad, Actors are good.” But the first extended example (admittedly, a buggy traditional implementation) uses synchronized. Why Scala supports this bad feature, if it does, is not stated, nor is any systematic way of removing it from programs presented.

While the section on selling Scala to organizations is thoughtful, it fails to address what is likely to be the single biggest concern of developers (and managers) considering a switch from Java: with the emphasis on transforming immutable collections into other immutable collections, what happens to performance? Although Pollak attempts to support his (unsupportable) assertion that “immutable data structures tend to perform better than mutable data structures,” his comparison of Scala’s List to Java’s ArrayList (instead of LinkedList) misses the point entirely.

Most of the book’s examples illustrate the use of Scala’s interactive execution mode; a few consist of larger (medium to huge) programs that apparently call for its traditional compilation mode. Emphasis on the interactive mode is perhaps in part a stylistic choice, made to fulfill the book’s tag line of “learn[ing] ... in a fun, interactive way.” But there is no systematic treatment of the difference between text acceptable to the interpreter and text acceptable to the compiler, and no help for the student who wants to convert the former to the latter.

Much is made of the fact that “the operational characteristics of Scala code are no different than Java code” and “stack traces in Scala ... look just like stack traces in Java code.” Stack traces are recognizably similar, of course--it is the same JVM, after all--but “just like” is an overstatement. Just as the introduction of inner classes into Java caused the information in stack traces to deviate from the source representation of programs, Scala’s broader syntactic difference from Java causes a broader deviation. This is evident from stack traces presented in the book; however, Pollak neither acknowledges this fact nor provides even passing guidance on mapping Scala stack traces back to Scala source.

Finally, a stylistic nit: extended examples (sometimes of many pages in length) are presented in their entirety, followed by a section-wise presentation of the exact same code interspersed with blow-by-blow commentary; this makes such examples about twice as long as necessary.

In summary, despite Pollak’s claim, “some programming background” is not enough to get the most out of this book. In fact, extensive Java experience is essential. Moreover, though Pollak bemoans his own inexperience with Lisp and ML before learning Scala, he doesn’t present a way for readers in a similar situation to come up to speed. Buy Beginning Scala, but don’t expect to begin Scala with it.

Reviewer:  Wes Munsil Review #: CR138323 (1106-0584)
Bookmark and Share
  Reviewer Selected
 
 
Object-Oriented Languages (D.3.2 ... )
 
 
Java (D.3.2 ... )
 
Would you recommend this review?
yes
no
Other reviews under "Object-Oriented Languages": Date
Understanding object-oriented: a unifying paradigm
Korson T., McGregor J. (ed) Communications of the ACM 33(9): 40-60, 1990. Type: Article
May 1 1991
From Fortran and Algol to object-oriented languages
Wilkes M. Communications of the ACM 36(7): 21-23, 1993. Type: Article
Nov 1 1994
Object-oriented programming with prototypes
Blaschek G., Springer-Verlag New York, Inc., New York, NY, 1994. Type: Book (9780387564692)
Feb 1 1995
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy