Pragmatic Scala

Book description

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.

The first edition of this book was released as Programming Scala.

Publisher resources

View/Submit Errata

Table of contents

  1. Pragmatic Scala
    1. For the Best Reading Experience...
    2. Table of Contents
    3. Early praise for Pragmatic Scala
    4. Acknowledgments
    5. Introduction
      1. Programming Styles in Scala
      2. Scala and Other Languages
      3. Who Is This Book For?
      4. What’s in This Book?
      5. Scala Version Used in This Book
      6. Online Resources
    6. Part 1: Getting Your Feet Wet
      1. Chapter 1: Exploring Scala
        1. Scala Features
        2. More with Less
        3. Functional Programming
        4. Wrapping Up
      2. Chapter 2: Taking Scala for a Ride
        1. Using the REPL
        2. Scala on the Command Line
        3. Running Scala Code as a Stand-alone Script
        4. Compiling Scala
        5. Wrapping Up
      3. Chapter 3: From Java to Scala
        1. Scala as Concise Java
        2. Scala Classes for Java Primitives
        3. Tuples and Multiple Assignments
        4. Flexible Parameters and Arguments
        5. Implicit Parameters
        6. Strings and Multiline Raw Strings
        7. String Interpolation
        8. Sensible Defaults
        9. Operator Overloading
        10. Scala Surprises for the Java Eyes
        11. Default Access Modifier
        12. Wrapping Up
      4. Chapter 4: Working with Objects
        1. Creating and Using Classes
        2. Following the JavaBean Convention
        3. Type Aliasing
        4. Extending a Class
        5. Parameterized Types
        6. Singletons and Companions
        7. Creating Enumerations
        8. Package Objects
        9. Wrapping Up
      5. Chapter 5: Making Use of Types
        1. Type Inference
        2. Fundamental Types
        3. Return Type Inference
        4. Variance of Parameterized Type
        5. Implicit Type Conversions
        6. Value Classes
        7. Using Implicit Conversions
        8. Wrapping Up
    7. Part 2: Diving Into Scala
      1. Chapter 6: Function Values and Closures
        1. Limitations of Normal Functions
        2. Extensibility with Higher-Order Functions
        3. Function Values with Multiple Parameters
        4. Currying
        5. Positional Notation for Parameters
        6. Parameter Routing
        7. Reusing Function Values
        8. Partially Applied Functions
        9. Closures
        10. Execute Around Method Pattern
        11. Wrapping Up
      2. Chapter 7: Traits
        1. Understanding Traits
        2. Selective Mixins
        3. Decorating with Traits
        4. Method Late Binding in Traits
        5. Wrapping Up
      3. Chapter 8: Collections
        1. Common Scala Collections
        2. Using a Set
        3. Associative Maps
        4. Immutable Lists
        5. Method Name Convention
        6. The for Expression
        7. Wrapping Up
      4. Chapter 9: Pattern Matching and Regular Expressions
        1. Comprehensive Matching
        2. Pattern Variables and Constants in case Expressions
        3. Matching Using case Classes
        4. Extractors and Regular Expressions
        5. The Omnipresent Underscore Character
        6. Wrapping Up
      5. Chapter 10: Handling Exceptions
        1. Exceptions in Scala
        2. Mind the Catch Order
        3. Wrapping Up
      6. Chapter 11: Programming Recursions
        1. A Simple Recursion
        2. Tail Call Optimization (TCO)
        3. Trampoline Calls
        4. Wrapping Up
    8. Part 3: Concurrency in Scala
      1. Chapter 12: Lazy Evaluations and Parallel Collections
        1. Let’s Get Lazy
        2. Making Strict Collections Lazy
        3. The Ultimately Lazy Streams
        4. Parallel Collections
        5. Wrapping Up
      2. Chapter 13: Programming with Actors
        1. A Sequential Time-Consuming Problem
        2. The Treacherous Paths to Concurrency
        3. Creating Actors
        4. Actors and Threads
        5. Isolated Mutability
        6. Concurrency with Actors
        7. Usage Recommendations
        8. Wrapping Up
    9. Part 4: Applying Scala
      1. Chapter 14: Intermixing with Java
        1. Using Scala Classes from Scala
        2. Using Java Classes from Scala
        3. Using Scala Methods from Java
        4. Using Traits from Java
        5. Using Singletons and Companion Objects from Java
        6. Extending Classes
        7. Wrapping Up
      2. Chapter 15: Creating an Application with Scala
        1. Getting Users’ Input
        2. Reading and Writing Files
        3. XML as a First-Class Citizen
        4. Reading and Writing XML
        5. Getting Stock Prices from the Web
        6. Making the Net Asset Application Concurrent
        7. Wrapping Up
      3. Chapter 16: Unit Testing
        1. Using JUnit
        2. Using ScalaTest
        3. Using Mockito
        4. Wrapping Up
    10. Appendix 1: Installing Scala
      1. Downloading
      2. Installing
    11. Appendix 2: Web Resources
    12. Bibliography
      1. You May Be Interested In…

Product information

  • Title: Pragmatic Scala
  • Author(s):
  • Release date: September 2015
  • Publisher(s): Pragmatic Bookshelf
  • ISBN: 9781680500547