http://www.spinellis.gr/pubs/Breview/2010-CR-Scala/html/review.html
This is an HTML rendering of a working paper draft that led to a publication. The publication should always be cited in preference to this draft using the following reference:

The document's metadata is available in BibTeX format.

Find the publication on Google Scholar

This material is presented to ensure timely dissemination of scholarly and technical work. Copyright and all rights therein are retained by authors or by other copyright holders. All persons copying this information are expected to adhere to the terms and constraints invoked by each author's copyright. In most cases, these works may not be reposted without the explicit permission of the copyright holder.

Diomidis Spinellis Publications


Copyright © 2010 by the Association for Computing Machinery, Inc. Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, to republish, to post on servers, or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from Publications Dept, ACM Inc., fax +1 (212) 869-0481, or permissions@acm.org.

Book Review: Programming in Scala: A Comprehensive Step-by-Step Guide

Diomidis Spinellis
Athens University of Economics and Business

Odersky M., Spoon L., Venners B.
Programming in Scala: A Comprehensive Step-by-Step Guide
Artima Incorporation, Mountain View, CA, 2008.
776 pp.

Writing a GUI spreadsheet application in 200 lines of code is certainly a tall order. Yet this is exactly the example provided in the last chapter of the book “Programming in Scala”. The program relies on many of Scala’s features described in the book: the integration of functional and object-oriented programming, an advanced type system allowing the enhancement of built-in types through traits, pattern matching combinators, and a powerful event-handling abstraction. And these are not all areas where Scala shines. In the scary new world of multicore processors it provides a robust foundation for concurrent programming by supporting immutable value types and adopting Erlang’s actor mechanism. Scala also aids the many developers relying mostly on application programming interfaces (APIs) by making the corresponding code appear as a domain-specific language. Its type system also helps in this regard by inferring types in the API client code, thereby reducing the verbosity associated with static typing. Furthermore, the type system promotes code robustness by handling null-like results. A carefully constructed class hierarchy gives all elements an object-like appearance without sacrificing efficiency. Other powerful features of Scala explained in the book’s 33 chapters include partially applied functions, lazy evaluation, nested packages, singleton objects, case classes, and native XML support. As one can surmise from the preceding description Scala is a large and complex language. Although it is compatible with Java’s ecosystem, Java programmers will have scores of new concepts to master, with the functional programming style being the most difficult and rewarding element. The larger examples included in the book demonstrate effectively the language’s power and appropriate design and implementation techniques.

Books introducing a new programming language are in the unenviable position of being compared with Kernighan and Ritchie’s classic The C Programming Language work. Judged by this exacting standard the book has room for improvement. A machete-wielding editor could create an superior second edition of the book by cutting down comparisons with Java, implementation details, advocacy, footnotes, and the many examples of errors and suboptimal alternatives. Ideally, such an edition would also allow mere mortals to understand the language’s more esoteric features, like the variance annotations and abstract members. In its current form the book serves programmers admirably as a detailed and complete guide to an exciting new language.