The Neophyte's Guide to Scala
Free!
With Membership
$14.99
Suggested price

The Neophyte's Guide to Scala

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.

  • Share this book

  • Categories

    • Computers and Programming
    • Functional Programming
  • Feedback

    Email the Author(s)

About the Author

Daniel Westheide
Daniel Westheide

Daniel Westheide is a software developer from Berlin, Germany. He has a background in human-computer interaction, semantic web technologies, and adaptive web applications, and has been working as a backend engineer since 2007. He has been using Scala and Clojure professionally since 2011 and likes to spread the love for functional programming and domain-driven design.

Table of Contents

  • Credits
  • Introduction
  • Extractors
    • Our first extractor, yay!
    • Extracting several values
    • A Boolean extractor
    • Infix operation patterns
    • A closer look at the Stream extractor
    • Using extractors
    • Summary
  • Extracting sequences
    • Example: Extracting given names
    • Combining fixed and variable parameter extraction
    • Summary
  • Patterns everywhere
    • Pattern matching expressions
    • Patterns in value definitions
    • Patterns in for comprehensions
    • Summary
  • Pattern matching anonymous functions
    • Partial functions
    • Summary
  • 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
    • Summary
  • Error handling with Try
    • Throwing and catching exceptions
    • Error handling, the functional way
    • Summary
  • The Either type
    • The semantics
    • Creating an Either
    • Working with Either values
    • When to use Either
    • Summary
  • Welcome to the Future
    • Why sequential code can be bad
    • Semantics of Future
    • Working with Futures
    • Summary
  • Promises and Futures in practice
    • Promises
    • Future-based programming in practice
    • Summary
  • 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
    • Summary
  • Currying and partially applied functions
    • Partially applied functions
    • Spicing up your functions
    • Summary
  • Type classes
    • The problem
    • Type classes to the rescue!
    • Use cases
    • Summary
  • Path-dependent types
    • The problem
    • Safer fiction with path-dependent types
    • Abstract type members
    • Path-dependent types in practice
    • Summary
  • The Actor approach to concurrency
    • The problems with shared mutable state
    • The Actor model
    • Summary
  • Dealing with failure in actor systems
    • Actor hierarchies
    • To crash or not to crash?
    • Summary
  • Where to go from here
    • Teaching Scala
    • Mastering arcane powers
    • Creating something useful
    • Contributing
    • Connecting
    • Other resources
    • Conclusion

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. 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) and EPUB (for phones, tablets and Kindle). 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.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub