Scala in Action
Nilanjan Raychaudhuri
Foreword by Chad Fowler
  • April 2013
  • ISBN 9781935182757
  • 416 pages
  • printed in black & white

A great way to get started on building real-world applications using Scala and its tools and frameworks.

Martin Odersky, Creator of Scala

Scala in Action is a comprehensive tutorial that introduces Scala through clear explanations and numerous hands-on examples. Because Scala is a rich and deep language, it can be daunting to absorb all the new concepts at once. This book takes a "how-to" approach, explaining language concepts as you explore familiar programming challenges that you face in your day-to-day work.

Table of Contents detailed table of contents




about this book

about the cover illustration

Part 1 Scala: the basics

1. Chapter 1 Why Scala?

1.1. What’s Scala?

1.2. The current crisis

1.3. Transitioning from Java to Scala

1.4. Coming from a dynamic language

1.5. For the programming language enthusiast

1.6. Summary

2. Chapter 2 Getting started

2.1. REPL with Scala interpreter

2.2. Scala basics

2.3. Working with Array and List

2.4. Controlling flow with loops and ifs

2.5. For-comprehensions

2.6. Pattern matching

2.7. Exception handling

2.8. Command-line REST client: building a working example

2.9. Summary

3. Chapter 3 OOP in Scala

3.1. Building a Scala MongoDB driver: user stories

3.2. Classes and constructors

3.3. Packaging

3.4. Scala imports

3.5. Objects and companion objects

3.6. Mixin with Scala traits

3.7. Case class

3.8. Named and default arguments and copy constructors

3.9. Modifiers

3.10. Value classes: objects on a diet

3.11. Implicit conversion with implicit classes

3.12. Scala class hierarchy

3.13. Summary

4. Chapter 4 Having fun with functional data structures

4.1. Introducing type parameterization

4.2. Type variance with covariance and contravariance

4.3. Lower and upper type bounds

4.4. Higher-order functions, including map, flatMap, and friends

4.5. Using foldLeft and foldRight

4.6. Building your own function objects

4.7. Scala collection hierarchy

4.8. Mutable and immutable collections

4.9. Working with List and ListBuffer

4.10. Working with lazy collections: views and streams

4.11. Divide and conquer with parallel collections

4.12. Summary

5. Chapter 5 Functional programming

5.1. What is functional programming?

5.2. Moving from OOP to functional programming

5.3. Functions in all shapes and forms

5.4. Thinking recursively

5.5. Algebraic data types

5.6. Why does functional programming matter?

5.7. Building higher abstractions with monads

5.8. Summary

Part 2 Working with Scala

6. Chapter 6 Building web applications in functional style

6.1. Building weKanban: a simple web-based Kanban board

6.2. Building Scala applications using Simple Build Tool

6.3. Introducing the Scalaz HTTP module

6.4. Summary

7. Chapter 7 Connecting to a database

7.1. Adding a new story to a weKanban board

7.2. Building the Kanban board page

7.3. Summary

8. Chapter 8 Building scalable and extensible components

8.1. Building your first component in Scala

8.2. Types of types in Scala

8.3. Ad hoc polymorphism with type classes

8.4. Summary

9. Chapter 9 Concurrency programming in Scala

9.1. What is concurrent programming?

9.2. Challenges with concurrent programming

9.3. Implementing message-passing concurrency with actors

9.4. Composing concurrent programs with Future and Promise

9.5. When should you not use actors?

9.6. Summary

10. Chapter 10 Building confidence with testing

10.1. Importance of automated testing

10.2. Automated test generation using ScalaCheck

10.3. Test-driven development cycle

10.4. Better tests with dependency injection

10.5. Behavior-driven development using Specs

10.6. Testing asynchronous messaging systems

10.7. Summary

Part 3 Advanced steps

11. Chapter 11 Interoperability between Scala and Java

11.1. Using Java classes in Scala

11.2. Using Scala classes in Java

11.3. Building web applications in Scala using Java frameworks

11.4. Summary

12. Chapter 12 Scalable and distributed applications using Akka

12.1. The philosophy behind Akka

12.2. Simple concurrency with Akka

12.3. Building a real-time pricing system: Akkaoogle

12.4. Adding asynchronous HTTP support with Play2-mini

12.5. Summary


© 2014 Manning Publications Co.

About the Technology

Scala runs on the JVM and combines object-orientation with functional programming. It's designed to produce succinct, type-safe code, which is crucial for enterprise applications. Scala implements Actor-based concurrency through the amazing Akka framework, so you can avoid Java's messy threading while interacting seamlessly with Java.

About the book

Scala in Action is a comprehensive tutorial that introduces the language through clear explanations and numerous hands-on examples. It takes a "how-to" approach, explaining language concepts as you explore familiar programming tasks. You'll tackle concurrent programming in Akka, learn to work with Scala and Spring, and learn how to build DSLs and other productivity tools. You'll learn both the language and how to use it.

What's inside

  • A Scala tutorial
  • How to use Java and Scala open source libraries
  • How to use SBT
  • Test-driven development
  • Debugging
  • Updated for Scala 2.10

About the reader

Experience with Java is helpful but not required. Ruby and Python programmers will also find this book accessible.

About the author

Nilanjan Raychaudhuri is a skilled developer, speaker, and an avid polyglot programmer who works with Scala on production systems.

Scala in Action (combo) added to cart
continue shopping
go to cart

combo $44.99 pBook + eBook + liveBook
Scala in Action (eBook) added to cart
continue shopping
go to cart

eBook $35.99 pdf + ePub + kindle + liveBook

FREE domestic shipping on three or more pBooks

Makes one wonder why functional programming isn't more widely used in the industry!

Alexandre Alves, Oracle Corp.

A must for any forward-looking Java developer.

Michael Smolyak, Next Century Corp.

Like having an experienced mentor.

From the Foreword by Chad Fowler, Author, Speaker, and Engineer