The Artima Developer Community


Programming in Scala cover

PrePrint™ Edition
Version 4
Published August 17, 2008
727 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 October 30, 2008. (Once the book has been printed, you'll be able to purchase just the paper book here for $49.99.)

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
List of Figures xviii
List of Tables xx
List of Listings xxi
Foreword xxviii
Preface xxx
Acknowledgments xxxi
Introduction xxxiii
1. A Scalable Language 41 (download free sample chapter PDF)
2. First Steps in Scala 60 (download free sample chapter PDF)
3. Next Steps in Scala 73
4. Classes and Objects 95
5. Basic Types and Operations 108
6. Functional Objects 130
7. Built-in Control Structures 150
8. Functions and Closures 174
9. Control Abstraction 195
10. Composition and Inheritance 210
11. Scala’s Hierarchy 238
12. Traits 246
13. Packages and Imports 265
14. Assertions and Unit Testing 280
15. Case Classes and Pattern Matching 294
16. Working with Lists 328
17. Collections 360
18. Stateful Objects 388
19. Type Parameterization 411
20. Abstract Members 436 (download free sample chapter PDF)
21. Implicit Conversions and Parameters 466
22. Implementing Lists 488
23. For Expressions Revisited 501
24. Extractors 517
25. Annotations 533
26. Working with XML 540
27. Modular Programming Using Objects 554
28. Object Equality 566
29. Combining Scala and Java 592
30. Actors and Concurrency 604
31. Combinator Parsing 635
32. GUI Programming 664
33. The SCells Spreadsheet 676
A. Scala scripts on Unix and Windows 701
Glossary 702
Bibliography 718
About the Authors 721
Index 722

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.


You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser