small medium large xlarge

Pragmatic Scala: Create Expressive, Concise, and Scalable Applications


Cover image for Pragmatic Scala

Pragmatic Scala

Create Expressive, Concise, and Scalable Applications


Our industry is moving toward functional programming, but your object-oriented experience is still valuable. Scala combines the power of OO and functional programming, and Pragmatic Scala shows you how to work effectively with both. Updated to Scala 2.11, with in-depth coverage of new features such as Akka actors, parallel collections, and tail call optimization, this book will show you how to create stellar applications.

Choose Your Format(s)

  • $46.00 In Stock

    Save $14.00 on the combo pack.

  • $36.00 In Stock
  • $24.00 In Stock
  • Ebooks are DRM free.

  • Ebook delivery options.

About this Title

Pages: 286
Published: 2015-09-18
Release: P1.0 (2015-09-22)
ISBN: 978-1-68050-054-7

This thorough introduction to Scala will get you coding in this powerful language right away. You’ll start from the familiar ground of Java and, with easy-to-follow examples, you’ll learn how to create highly concise and expressive applications with Scala. You’ll find out when and how to mix both imperative and functional style, and how to use parallel collections and Akka actors to create high-performance concurrent applications that effectively use multicore processors.

Scala has evolved since the first edition of this book, and Pragmatic Scala is a significant update. We’ve revised each chapter, and added three new chapters and six new sections to explore the new features in Scala. You’ll learn how to:

  • Safely manage concurrency with parallel collections and Akka actors
  • Create expressive readable code with value classes and improved implicit conversions
  • Create strings from data with no sweat using string interpolation
  • Create domain-specific languages
  • Optimize your recursions with tail call optimization

Whether you’re interested in creating concise, robust single-threaded applications or highly expressive, thread-safe concurrent programs, this book has you covered.

Read the reviews .

What You Need

The Scala compiler (2.x) and the JDK are required to make use of the concepts and the examples in this book.

Contents & Extracts

  • Getting Your Feet Wet
    • Exploring Scala excerpt
      • Scala Features
      • More with Less
      • Functional Programming
      • Wrapping Up
    • Taking Scala for a Ride
      • Using the REPL
      • Scala on the Command Line
      • Running Scala Code as a Standalone Script
      • Compiling Scala
      • Wrapping Up
    • From Java to Scala
      • Scala as Concise Java
      • Scala Classes for Java Primitives
      • Tuples and Multiple Assignments
      • Flexible Parameters and Arguments
      • Implicit Parameters
      • Strings and Multiline Raw Strings
      • String Interpolation
      • Sensible Defaults
      • Operator Overloading
      • Scala Surprises for the Java Eyes
      • Default Access Modifier
      • Wrapping Up
    • Working with Objects
      • Creating and Using Classes
      • Following the JavaBean Convention
      • Type Aliasing
      • Extending a Class
      • Parameterized Types
      • Singletons and Companions
      • Creating Enumerations
      • Package Objects
      • Wrapping Up
    • Making Use of Types
      • Type Inference
      • Fundamental Types
      • Return Type Inference
      • Variance of Parameterized Type
      • Implicit Type Conversions
      • Value Classes
      • Using Implicit Conversions
      • Wrapping Up
  • Diving Into Scala
    • Function Values and Closures excerpt
      • Limitations of Normal Functions
      • Extensibility with Higher Order Functions
      • Function Values with Multiple Parameters
      • Currying
      • Positional Notation for Parameters
      • Parameter Routing
      • Reusing Function Values
      • Partially Applied Functions
      • Closures
      • Execute Around Method Pattern
      • Wrapping Up
    • Traits
      • Understanding Traits
      • Selective Mixins
      • Decorating with Traits
      • Method Late Binding in Traits
      • Wrapping Up
    • Collections
      • Common Scala Collections
      • Using a Set
      • Associative Maps
      • Immutable Lists
      • Method Name Convention
      • The for Expression
      • Wrapping Up
    • Pattern Matching and Regular Expressions
      • Comprehensive Matching
      • Pattern Variables and Constants in case Expressions
      • Matching Using case Classes
      • Extractors and Regular Expressions
      • The Omnipresent Underscore Character
      • Wrapping Up
    • Handling Exceptions
      • Exceptions in Scala
      • Mind the Catch Order
      • Wrapping Up
    • Programming Recursions excerpt
      • A Simple Recursion
      • Tail Call Optimization (TCO)
      • Trampoline Calls
      • Wrapping Up
  • Concurrency in Scala
    • Lazy Evaluations and Parallel Collections
      • Let’s Get Lazy
      • Making Strict Collections Lazy
      • The Ultimately Lazy Streams
      • Parallel Collections
      • Wrapping Up
    • Programming with Actors
      • A Sequential Time-Consuming Problem
      • The Treacherous Paths to Concurrency
      • Creating Actors
      • Actors and Threads
      • Isolated Mutability
      • Concurrency with Actors
      • Usage Recommendations
      • Wrapping Up
  • Applying Scala
    • Intermixing with Java
      • Using Scala Classes from Scala
      • Using Java Classes from Scala
      • Using Scala Methods from Java
      • Using Traits from Java
      • Using Singletons and Companion Objects from Java
      • Extending Classes
      • Wrapping Up
    • Creating an Application with Scala
      • Getting Users’ Input
      • Reading and Writing Files
      • XML as a First-Class Citizen
      • Reading and Writing XML
      • Getting Stock Prices from the Web
      • Making the Net Asset Application Concurrent
      • Wrapping Up
    • Unit Testing
      • Using JUnit
      • Using ScalaTest
      • Using Mockito
    • Installing Scala
      • Downloading
      • Installing
    • Web Resources
    • Bibliography


Dr. Venkat Subramaniam is an award-winning author, founder of Agile Developer, Inc., and an adjunct faculty at the University of Houston. He has trained and mentored thousands of software developers in the US, Canada, Europe, and Asia, and is a regularly invited speaker at several international conferences. He’s the (co)author of multiple books, including the 2007 Jolt Productivity award winning book Practices of an Agile Developer.