The Neophyte's Guide to Scala
This book is 100% complete
Completed on 2018-02-07
About the Book
The Neophyte's Guide to Scala is a book for intermediate Scala developers. If you have made your first steps with Scala and functional programming, for example by participating in Martin Odersky's Coursera course Functional Programming Principles in Scala, and you don't know how to continue, this book is for you.
Originally published as a blog series from November 2012 to April 2013, the Neophyte's Guide to Scala is now available as an ebook, a compilation of all 16 articles.
In this book, you will learn the details of how to employ pattern matching and extractors, working with the omnipresent Option and similar types in an idiomatic way, and leveraging higher-order functions and currying to keep your code DRY. Furthermore, you will gain insight into advanced Scala features like type classes and path-dependent types and about Scala's approach at concurrent programming: Learn about the power of Scala's futures and the actor model, as implemented in the popular Akka toolkit.
- Our first extractor, yay!
- Extracting several values
- A Boolean extractor
- Infix operation patterns
- A closer look at the Stream extractor
- Using extractors
- Example: Extracting given names
- Combining fixed and variable parameter extraction
- Pattern matching expressions
- Patterns in value definitions
- Patterns in for comprehensions
Pattern matching anonymous functions
- Partial functions
The Option type
- The basic idea
- Creating an option
- Working with optional values
- Providing a default value
- Pattern matching
- Options can be viewed as collections
- For comprehensions
- Chaining options
Error handling with Try
- Throwing and catching exceptions
- Error handling, the functional way
The Either type
- The semantics
- Creating an Either
- Working with Either values
- When to use Either
Welcome to the Future
- Why sequential code can be bad
- Semantics of Future
- Working with Futures
Promises and Futures in practice
- Future-based programming in practice
Staying DRY with higher-order functions
- On higher-order functions
- And out of nowhere, a function was born
- Reusing existing functions
- Function composition
- Higher-order functions and partial functions
Currying and partially applied functions
- Partially applied functions
- Spicing up your functions
- The problem
- Type classes to the rescue!
- Use cases
- The problem
- Safer fiction with path-dependent types
- Abstract type members
- Path-dependent types in practice
The Actor approach to concurrency
- The problems with shared mutable state
- The Actor model
Dealing with failure in actor systems
- Actor hierarchies
- To crash or not to crash?
Where to go from here
- Teaching Scala
- Mastering arcane powers
- Creating something useful
- Other resources
The Leanpub 45-day 100% Happiness Guarantee
Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
Free Updates. Free App. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets), MOBI (for Kindle) and in the free Leanpub App (for Mac, Windows, iOS and Android). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.