Beginning Scala

By David Pollak

Beginning Scala Cover Image

Written by Lift Scala web framework founder and lead Dave Pollak, Beginning Scala takes a down-to-earth approach to teaching Scala that leads you through simple examples that can be combined to build complex, scalable systems and applications.

Full Description

  • ISBN13: 978-1-4302-1989-7
  • User Level: Beginner to Intermediate
  • Publication Date: May 24, 2009
  • Available eBook Formats: EPUB, MOBI, PDF
  • Print Book Price: $39.99
  • eBook Price: $27.99
Buy eBook Buy Print Book Add to Wishlist

Related Titles

Full Description

The open source Scala language is a Java-based dynamic scripting, functional programming language. Moreover, this highly scalable scripting language lends itself well to building cloud-based/deliverable Software as a Service (SaaS) online applications.

Written by Lift Scala web framework founder and lead Dave Pollak, Beginning Scala takes a down-to-earth approach to teaching Scala that leads you through simple examples that can be combined to build complex, scalable systems and applications.

This book introduces you to the Scala programming language and then guides you through Scala constructs and libraries that allow small and large teams to assemble small components into high-performance, scalable systems. You will learn why Scala is becoming the language of choice for Web 2.0 companies such as Twitter as well as enterprises such as Seimens and SAP.

What you’ll learn

  • Get running with the Scala programming language for functional Java, Java-based, and cloud-based/deliverable applications development, and more.
  • Understand the basic syntax and mechanisms for writing Scala programs.
  • Discover the techniques for and advantages of using immutable data structures.
  • Create functional programming techniques for defining and managing concurrency.
  • Use a complex type system and traits to define object-oriented programs.
  • Work with Scala constructs and libraries that allow teams of any size to assemble small components into high-performance, scalable systems.
  • Build complex systems based on the simple examples learned along the way through this book.

Who this book is for

Java developers looking to reduce boilerplate, improve team performance, improve interteam dynamics, and build more scalable and robust systems. Also, this book will appeal to Java developers looking to do cloud-based development. Lastly, Ruby, Python, and Groovy programmers looking for a higher performance and a more robust language will benefit.

Table of Contents

Table of Contents

  1. About Scala and How to Install It
  2. Scala Syntax, Scripts, and Your First Scala Programs
  3. Collections and the Joy of Immutability
  4. Fun with Functions, and Never Having to Close That JDBC Connection
  5. Pattern Matching
  6. Actors and Concurrency
  7. Traits and Types and Gnarly Stuff for Architects
  8. Parsers—Because BNF Is Not Just for Academics Anymore
  9. Scaling Your Team
Source Code/Downloads

Downloads are available to accompany this book.

Your operating system can likely extract zipped downloads automatically, but you may require software such as WinZip for PC, or StuffIt on a Mac.

Errata

Please Login to submit errata.

On page 16:

val lines = input.getLines.collect

\sum.scala:19: error: missing arguments for method collect in trait Iterator;

follow this method with `_' if you want to treat it as a partially applied function

val lines = input.getLines.collect
^
one error found

On Scala 2.9.01. What's the error ?

On page 16:
Code for Sum.scala does not compile under scala-2.9.0.1:

Sum.scala:19: error: missing arguments for method collect in trait Iterator;
follow this method with `_' if you want to treat it as a partially applied function
val lines = input.getLines.collect

On page 25:
"param.meow" should be "otherparam.meow"

object OtherDude extends Yep {
def twoMeows(otherparam: Yep) = meow + ", " + param.meow
}

On page 25:

and add new methods:

object OtherDude extends Yep {
def twoMeows(otherparam: Yep) = meow + ", " + param.meow
}

is Wrong. Try this:

object OtherDude extends Yep {
def twoMeows(otherparam: Yep) = meow + ", " + otherparam.meow
}

On page 228:

trying (and failing) to run Dwemthy stairs example interactively under scala 2.9.1; it barfs at the first reference to Them

<console>:31: error: not found: type Them
protected case class Weapon(turn: (Us, Them) => (Us, Them)) {

I can make it work from the scala command line, but this is not really in line with how the book describes it.