The Artima Developer Community


Programming in Scala cover

PrePrint™ Edition
Version 3
Published May 4, 2008
636 pages

Programming in Scala
A comprehensive step-by-step guide

by Martin Odersky, Lex Spoon, and Bill Venners

This book is the authoritative tutorial on the Scala programming language, co-written by the language's designer, Martin Odersky. While mostly complete, the book is still a work in progress. This early access program will allow you to learn about Scala from the source and provide helpful feedback to the authors that will make the book even better.

If you purchase just the PDF eBook for $27.50, you will be entitled to receive periodic updates as the authors complete the book, as well as the final PDF when the book is finished, for no additional charge. If you purchase PDF + Paper Book combo for $59.99, you will be entitled to the PDF eBook updates, and we'll ship you the paper book when it is published, on or around August 30, 2008.

Purchase and download the PDF eBook now

Format Quantity

About the book

Scala is an object-oriented programming language for the Java Virtual Machine. In addition to being object-oriented, Scala is also a functional language, and combines the best approaches to OO and functional programming.

In Italian, Scala means a stairway, or steps—indeed, Scala lets you step up to a programming environment that incorporates some of the best recent thinking in programming language design while also letting you use all your existing Java code.

Artima is very pleased to publish the first book on Scala, written by the designer of the language, Martin Odersky. Co-authored by Lex Spoon and Bill Venners this book takes a step-by-step tutorial approach to teaching you Scala. Starting with the fundamental elements of the language, Programming in Scala introduces functional programming from the practitioner's perspective, and describes advanced language features that can make you a better, more productive developer.

Table of contents

Contents viii
Foreword xvii
Preface xix
Acknowledgments xx
Introduction xxii
1. A Scalable Language 29 (download free sample chapter PDF)
2. First Steps in Scala 48 (download free sample chapter PDF)
3. Next Steps in Scala 62
4. Classes and Objects 83
5. Basic Types and Operations 100
6. Functional Objects 121
7. Built-in Control Structures 140
8. Functions and Closures 157
9. Control Abstraction 178
10. Composition and Inheritance 193
11. Scala’s Hierarchy 218
12. Traits 226
13. Packages and Imports 243
14. Assertions and Unit Testing 257
15. Case Classes and Pattern Matching 267
16. Working with Lists 298
17. Collections 328
18. Stateful Objects 349
19. Type Parameterization 369
20. Abstract Members 387 (download free sample chapter PDF)
21. Implicit Conversions and Parameters 404
22. Implementing Lists 422
23. For-Expressions Revisited 433
24. Extractors 448
25. Annotations 463
26. Working with XML 469
27. Objects As Modules 482
28. Object Equality 493
29. Combining Scala and Java 507
30. Actors and Concurrency 519
31. Combinator Parsing 550
32. GUI Programming 579
33. The SCells Spreadsheet 590
Glossary 615
Bibliography 630
About the Authors 632
Index 634

About the authors

Martin Odersky is the creator of the Scala language. As a professor at EPFL in Lausanne, Switzerland he is working on programming languages, more specifically languages for object-oriented and functional programming. His research thesis is that the two paradigms are two sides of the same coin, to be identified as much as possible. To prove this, he has experimented with a number of language designs, from Pizza to GJ to Functional Nets. He has also influenced the development of Java as a co-designer of Java generics and as the original author of the current javac reference compiler. Since 2001 he has concentrated on designing, implementing, and refining the Scala programming language.

Lex Spoon worked on Scala for two years as a post-doc at EPFL. He has a Ph.D. in computer science from Georgia Tech. His research is on programming environments and on better support for distributed development. In addition to Scala, he has worked on a wide variety of languages, including the dynamic language Smalltalk and the scientific language X10. He and his wife live in Atlanta with two cats and a turtle.

Bill Venners is president of Artima, Inc., which publishes the Artima Developer website at www.artima.com. He is author of the book, Inside the Java Virtual Machine, a programmer-oriented survey of the Java platform's archi- tecture and internals. His popular columns in JavaWorld magazine covered Java internals, object-oriented design, and Jini. Bill has been active in the Jini Community since its inception. He led the Jini Community's ServiceUI project, whose ServiceUI API became the de facto standard way to associate user interfaces to Jini services.

Copyright © 2007 Artima, Inc. All rights reserved.