Preface
The evolution of Java and C++ has slowed down considerably, and programmers who are eager to use more modern language
features are looking elsewhere. Scala is an attractive choice; in fact, I think it is by far the most attractive choice for
programmers who want to move beyond Java or C++. Scala has a concise syntax that is refreshing after the Java boilerplate. It
runs on the Java virtual machine, providing access to a huge set of libraries and tools. It embraces the functional programming
style without abandoning object orientation, giving you an incremental learning path to a new paradigm. The Scala interpreter
lets you run quick experiments, which makes learning Scala very enjoyable. Last but not least, Scala is statically typed, enabling
the compiler to find errors, so that you don’t waste time finding them—or not—later in the running program.
I wrote this book for impatient readers who want to start programming in Scala right away. I assume you know Java, C#, or
C++, and I don’t bore you with explaining variables, loops, or classes. I don’t exhaustively list all the features of the language, I
don’t lecture you about the superiority of one paradigm over another, and I don’t make you suffer through long and contrived
examples. Instead, you will get the information that you need in compact chunks that you can read and review as needed.
Scala is a big language, but you can use it effectively without knowing all of its details intimately. Martin Odersky, the creator of
Scala, has identified levels of expertise for application programmers and library designers—as shown in the following table.
For each chapter (and occasionally for individual sections), I indicate the experience level required. The chapters progress
through levels , , , , , . Even if you don’t want to design your own libraries, knowing about the tools that
Scala provides for library designers can make you a more effective library user.
I hope you enjoy learning Scala with this book. If you find errors or have suggestions for improvement, please visit
http://horstmann.com/scala and leave a comment. On that page, you will also find a link to an archive file containing all code
examples from the book.
I am very grateful to Dmitry Kirsanov and Alina Kirsanova who turned my manuscript from XHTML into a beautiful book, allowing
me to concentrate on the content instead of fussing with the format. Every author should have it so good!
Reviewers include Adrian Cumiskey, Mike Davis, Rob Dickens, Daniel Sobral, Craig Tataryn, David Walend, and William
Wheeler. Thanks so much for your comments and suggestions!
Finally, as always, my gratitude goes to my editor, Greg Doench, for encouraging me to write this book, and for his insights
during the development process.
Cay Horstmann
San Francisco, 2012