Contents


foreword
preface
acknowledgments
about this book
about the cover illustration
 
Chapter 1 Scala—a blended language
Functional programming meets object orientation
Static typing and expressiveness
Transparently working with the JVM
Summary
Chapter 2 The core rules
Learn to use the Read Eval Print Loop (REPL)
Think in expressions
Prefer immutability
Use None instead of null
Polymorphic equality
Summary
Chapter 3 Modicum of style—coding conventions
Avoid coding conventions from other languages
Dangling operators and parenthetical expressions
Use meaningful variable names
Always mark overridden methods
Annotate for expected optimizations
Summary
Chapterr 4 Utilizing object orientation
Limit code inside an object or trait’s body to initialization logic
Provide empty implementations for abstract methods on traits
Composition can include inheritance
Promote abstract interface into its own trait
Provide return types in your public APIs
Summary
Chapter 5 Using implicits to write expressive code
Introduction to implicits
Enhancing existing classes with implicit views
Utilize implicit parameters with defaults
Limiting the scope of implicits
Summary
Chapter 6 The type system
Types
Type constraints
Type parameters and higher-kinded types
Variance
Existential types
Summary
Chapter 7 Using implicits and types together
Context bounds and view bounds
Capturing types with implicits
Use type classes
Conditional execution using the type system
Summary
Chapter 8 Using the right collection
Use the right collection
Immutable collections
Mutable collections
Changing evaluation with views and parallel collections
Writing methods to use with all collection types
Summary
Chapter 9 Actors
Know when to use actors
Use typed, transparent references
Limit failures to zones
Limit overload using scheduler zones
ynamic actor topology
Summary
Chapter 10 Integrating Scala with Java
The language mismatch between Scala and Java
Be wary of implicit conversions
Be wary of Java serialization
Annotate your annotations
Summary
Chapter 11 Patterns in functional programming
Category theory for computer science
Functors and monads, and how they relate to categories
Currying and applicative style
Monads as workflows
Summary

index