Scala in Depth
Joshua D. Suereth
Foreword by Martin Odersky
  • May 2012
  • ISBN 9781935182702
  • 304 pages
  • printed in black & white

Authorative and understandable.

Martin Odersky, Creator of Scala

Scala in Depth is a unique new book designed to help you integrate Scala effectively into your development process. By presenting the emerging best practices and designs from the Scala community, it guides you through dozens of powerful techniques example by example.

Table of Contents show full




about this book

about the cover illustration

1. Scala—a blended language

1.1. Functional programming meets object orientation

1.2. Static typing and expressiveness

1.3. Transparently working with the JVM

1.4. Summary

2. The core rules

2.1. Learn to use the Read Eval Print Loop (REPL)

2.2. Think in expressions

2.3. Prefer immutability

2.4. Use None instead of null

2.5. Polymorphic equality

2.6. Summary

3. Modicum of style—coding conventions

3.1. Avoid coding conventions from other languages

3.2. Dangling operators and parenthetical expressions

3.3. Use meaningful variable names

3.4. Always mark overridden methods

3.5. Annotate for expected optimizations

3.6. Summary

4. Utilizing object orientation

4.1. Limit code inside an object or trait’s body to initialization logic

4.2. Provide empty implementations for abstract methods on traits

4.3. Composition can include inheritance

4.4. Promote abstract interface into its own trait

4.5. Provide return types in your public APIs

4.6. Summary

5. Using implicits to write expressive code

5.1. Introduction to implicits

5.2. Enhancing existing classes with implicit views

5.3. Utilize implicit parameters with defaults

5.4. Limiting the scope of implicits

5.5. Summary

6. The type system

6.1. Types

6.2. Type constraints

6.3. Type parameters and higher-kinded types

6.4. Variance

6.5. Existential types

6.6. Summary

7. Using implicits and types together

7.1. Context bounds and view bounds

7.2. Capturing types with implicits

7.3. Use type classes

7.4. Conditional execution using the type system

7.5. Summary

8. Using the right collection

8.1. Use the right collection

8.2. Immutable collections

8.3. Mutable collections

8.4. Changing evaluation with views and parallel collections

8.5. Writing methods to use with all collection types

8.6. Summary

9. Actors

9.1. Know when to use actors

9.2. Use typed, transparent references

9.3. Limit failures to zones

9.4. Limit overload using scheduler zones

9.5. Dynamic actor topology

9.6. Summary

10. Integrating Scala with Java

10.1. The language mismatch between Scala and Java

10.2. Be wary of implicit conversions

10.3. Be wary of Java serialization

10.4. Annotate your annotations

10.5. Summary

11. Patterns in functional programming

11.1. Category theory for computer science

11.2. Functors and monads, and how they relate to categories

11.3. Currying and applicative style

11.4. Monads as workflows

11.5. Summary


About the book

Scala is a powerful JVM language that blends the functional and OO programming models. You'll have no trouble getting introductions to Scala in books or online, but it's hard to find great examples and insights from experienced practitioners. You'll find them in Scala in Depth. There's little heavy-handed theory here—just dozens of crisp, practical techniques for coding in Scala.

What's inside

  • Concise, expressive, and readable code style
  • Integrate Scala into your existing Java projects
  • Scala's 2.8.0 collections API
  • How to use actors for concurrent programming
  • Mastering the Scala type system
  • Scala's OO features—type member inheritance, multiple inheritance, and composition
  • Functional concepts and patterns—immutability, applicative functors, and monads

About the reader

Written for readers who know Java, Scala, or another OO language.

About the author

Josh Suereth is a software developer with Typesafe. He is a Scala committer and the maintainer of

combo $49.99 pBook + eBook
eBook $39.99 pdf + ePub + kindle

FREE domestic shipping on three or more pBooks

Takes you deep into the inner workings of Scala.

John C. Tyler, PROS Pricing

By far the best examples I've seen in any technical book.

Eric Weinberg, Wagger Designs

An eye opener! Now I know why Scala does what it does.

John Griffin, Coauthor of Hibernate Search in Action