Books

7 Best Scala Books for Scala 3 in 2026

This post contains affiliate links. If you buy through them, we may earn a small commission at no extra cost to you. Learn more.

Programming in Scala, Fifth Edition is the Scala 3 book to buy if you only buy one. Martin Odersky, who created the language, co-wrote it, and it teaches givens, enums and extension methods as the normal way to write Scala. Add Functional Programming in Scala when you want the functional side done properly.

Original content from computingforgeeks.com - post 179519

All seven Scala books below cover Scala 3, but their example code doesn’t all build on the current compiler. We built four of the companion repositories on Ubuntu 26.04 with Scala 3.10.0 and JDK 21, still the current stable compiler when we checked in November 2026, and three of them needed changes on that toolchain.

Which Scala book should you buy first?

Pick by what you already know, not by which cover says Scala 3 the loudest. Every book here targets Scala 3, so the real differences are pace, depth and how much functional programming theory you want:

  • You want one complete tutorial and reference: Programming in Scala, Fifth Edition.
  • You already write Java, Kotlin or C# and want the fast route: Scala for the Impatient, Third Edition.
  • You want to think in pure functions, monads and effects: Functional Programming in Scala, Second Edition.
  • You learned Scala 2 and need Scala 3 with working code: Programming Scala, Third Edition.
  • You are new to Scala and want short lessons with exercises: Get Programming with Scala.
  • You need a recipe for a task you have right now: Scala Cookbook, Second Edition.
  • You are heading for ZIO and effect systems: Effect Oriented Programming.

For most people coming from Java, the pair that covers the most ground is Scala for the Impatient for the language and Functional Programming in Scala for the thinking behind it. Programming in Scala replaces the first of those if you prefer one long, careful book over a fast one. Buy the second book later, once you can read Scala without stopping on every line, because the functional material assumes that fluency.

How do the seven Scala books compare?

Our “code today” column is the result of our own build of each published example repository on the current Scala 3 compiler. It tells you how much setup friction to expect before chapter 1:

BookBest forScala in the codeCode todayPagesPublished
Programming in Scala, 5th ed.One complete tutorial3.0No public repo to test6682021
Scala for the Impatient, 3rd ed.Java developers in a hurry3.2Worksheets compile, old sbt pin fails4002022
Functional Programming in Scala, 2nd ed.Functional programming3.3Builds on 3.3, needs one flag removed on 3.104882023
Programming Scala, 3rd ed.Moving from Scala 23.9Builds clean5532021
Get Programming with ScalaFirst steps in Scala3.0 (2.13 in 3 lessons)Needs newer sbt and Scala5602021
Scala Cookbook, 2nd ed.Task recipes3.0Not built7992021
Effect Oriented ProgrammingZIO and effects3.5 with ZIO 2Not built1542024

Page counts and dates come from the Amazon catalog for the print edition. Prices ran from about $18 to $60 on October 29, and four of the listings showed only a few copies in stock. Check the current price and the seller before you order, because a third-party seller can charge far more than list.

Does Scala 2 book code still compile on Scala 3?

No, not without changes. Four habits that fill older Scala books stop the current Scala 3 compiler cold. That’s why a cheap used copy of a Scala 2 era book costs you more time than it saves. We wrote a small file in that older style to see exactly what breaks.

You need the scala command for this test, so follow the install steps in the last section first if you do not have it. Then create a folder for the test and open the file:

mkdir old && cd old
vim OldBook.scala

Paste this code. It uses procedure syntax, a symbol literal, a do/while loop, a call without parentheses and an implicit class:

// Scala 2 era book code
object OldBook {
  def greet(name: String) {
    println("Hello, " + name)
  }

  val status = 'active

  def countdown(): Unit = {
    var i = 3
    do {
      println(i)
      i -= 1
    } while (i > 0)
  }

  implicit class RichInt(n: Int) {
    def squared: Int = n * n
  }

  def main(args: Array[String]): Unit = {
    greet("Scala")
    println(status)
    countdown
    println(4.squared)
  }
}

Compile it with the scala command, which is Scala CLI in current Scala 3 releases:

scala compile .

The build fails with four errors, one for each old habit. The implicit class is the only Scala 2 idiom in the file that still compiles:

Scala 3.10 compile errors for Scala 2 book code: procedure syntax, symbol literal, do while and auto-application

Watch for these four changes in any book that predates Scala 3. Each one shows up in that output:

  • A method body written as def greet(name: String) { needs : Unit = before the brace.
  • A symbol literal such as 'active becomes Symbol("active") or, better, a plain string.
  • A do { ... } while (cond) loop is gone and has to become a while loop.
  • A method declared with () must be called with (), so countdown becomes countdown().

You don’t have to fix all of that by hand. The migration mode of the compiler accepts the old syntax as warnings, and -rewrite patches the file in place, as the Scala 3 migration guide describes:

scala compile . -O -source:3.0-migration -O -rewrite
scala run .

After the rewrite, one warning remained, all four spots were patched anyway, and the program ran with the expected output:

scala compile with -source:3.0-migration -rewrite patching Scala 2 book code, then running it on Scala 3.10

The patched loop is correct but ugly. The rewrite turned it into while ({ { ... } ; i > 0}) (), which no Scala 3 book would teach. That’s the real cost of learning from an old book: the code runs, but you learn idioms that current code bases have already replaced. Buy one of the Scala 3 editions below instead.

1. Programming in Scala, Fifth Edition

Martin Odersky wrote this book with Lex Spoon, Bill Venners and Frank Sommers. Artima, the publisher, calls it the authoritative tutorial on Scala.

Programming in Scala Fifth Edition by Martin Odersky, Lex Spoon, Bill Venners and Frank Sommers book cover
Programming in Scala, Fifth Edition by Martin Odersky, Lex Spoon, Bill Venners and Frank Sommers. Image: Artima.

The fifth edition was rewritten for Scala 3.0, and the table of contents shows it. There are whole chapters on enums, givens, extension methods and typeclasses, plus a chapter on packages, imports and the new exports. It starts from first steps and ends at testing, so it works as a tutorial first and as a reference you keep open later.

Skip it if you want projects or a fast pace. At 668 pages it explains every rule carefully, and there’s no single build you follow from start to finish. We found no public companion repository to compile either, so you type the examples yourself. That suits a careful learner and frustrates an impatient one. The paperback ran about $45 to $50 on Amazon with limited stock.

2. Scala for the Impatient, Third Edition

Cay Horstmann wrote this one for programmers who already know another language well. It skips the beginner material and goes straight to what is different in Scala 3.

Scala for the Impatient Third Edition by Cay S. Horstmann book cover, covers Scala 3.x
Scala for the Impatient, Third Edition by Cay S. Horstmann. Image: Pearson.

Horstmann names Java, C#, Python, JavaScript and C++ developers as the audience. The chapters move quickly through enums, union and intersection types, contextual abstractions, futures and a first look at type-level programming and macros. If you think in Java, this is the shortest path from reading Scala to writing it.

The code download from horstmann.com is a zip of 20 chapter folders, mostly worksheets meant for an IDE. Every chapter pins sbt 1.8.0, and all but one pin Scala 3.2. That old sbt crashed under the current sbt launcher on JDK 21 with NoClassDefFoundError: Could not initialize class sbt.internal.parser.SbtParser$, but the worksheets themselves compiled fine with scala run. Open them in VS Code with Metals or run them directly instead of fighting the old build. Skip this book if you have never programmed before. It ran about $35 to $40.

3. Functional Programming in Scala, Second Edition

This book teaches functional programming through exercises. Manning says the second edition brings full code updates to Scala 3, and the repository confirms it.

Functional Programming in Scala Second Edition by Michael Pilquist, Runar Bjarnason and Paul Chiusano book cover
Functional Programming in Scala, Second Edition by Michael Pilquist, Rúnar Bjarnason and Paul Chiusano. Image: Manning.

Michael Pilquist, Rúnar Bjarnason and Paul Chiusano build everything from first principles. The chapters cover error handling without exceptions, laziness, purely functional state, parallelism, property testing, parsers, monoids, monads, applicatives and finally purely functional I/O and streaming. You write the library yourself, chapter by chapter, so by the end you know what libraries like Cats and ZIO do for you instead of only calling them.

Our build of the official repository worked on the Scala 3.3 version it pins. When we pointed the same code at the current Scala 3.10 release, it failed with 157 errors across 36 files, almost all from the old given ... with syntax:

fpinscala second edition code failing on Scala 3.10 with old given syntax errors under -source:future

The cause is one line in build.scala: //> using options -source:future. On 3.10 that flag turns on future-version rules that drop the old given syntax, so the newer compiler rejects code the older one accepted. With the line removed, the whole project compiled on 3.10 with only 15 warnings. Before you start the exercises, check these three things:

  • Your clone is on the second-edition branch, not the first-edition one.
  • The //> using scala line still names the version the repository pins.
  • scala-cli compile . finishes with “Compiled project” before you edit anything.

Skip the book if you want to learn Scala syntax first, because it assumes you can already read it. It ran about $60, the most expensive book in this list, but it is also the one that keeps paying off after you know the syntax. If these chapters leave you wanting more of the pure functional side, our Haskell books guide covers the language where many of these ideas started.

4. Programming Scala, Third Edition

Dean Wampler wrote the best fit for developers who learned Scala 2 and now maintain or migrate Scala 3 code. It also has the best maintained example code of the seven.

Programming Scala Third Edition by Dean Wampler book cover, covers Scala 3
Programming Scala, Third Edition by Dean Wampler. Image: O’Reilly Media.

O’Reilly pitches it at beginning to advanced developers, and the third edition “covers the new features in Scala 3.0 with updates throughout the book”, with Spark and Akka examples along the way. The tools chapter explains the language version setting that Scala 3 added for migrating Scala 2 code bases. That is the part a Scala 2 developer needs most, because it lets you move a code base one warning at a time.

Wampler keeps the example code on a current Scala release and compiles it with -source:future-migration and -rewrite, so new deprecations show up early and a newer compiler can patch your checked-out sources in place. That care paid off in our test. The 141 Scala sources and 4 Java sources compiled with zero warnings on the Scala 3.9 LTS release the repository pins, and again after we switched it to 3.10. The trade-off is that the code has moved past the printed book in places, a point the README makes itself. Check the tag for the printed version when a listing differs. It ran about $50 to $55, well below list price.

5. Get Programming with Scala

Daniela Sfregola wrote this for developers who know an object-oriented language and have never touched Scala or functional programming. It is the gentlest start in the list.

Get Programming with Scala by Daniela Sfregola book cover, covers Scala 3
Get Programming with Scala by Daniela Sfregola. Image: Manning.

The book is split into short lessons with a capstone project at the end of each unit, and Manning describes it as covering both Scala 2 and Scala 3. That split shows in the code. Fifty lesson builds use Scala 3.0, and three stay on Scala 2.13 because the Quill database library had no Scala 3 build at the time.

The lesson builds pin the oldest Scala and sbt among the repositories we built, so they fail on a current JDK. In lesson 52 the pinned sbt 1.5.2 crashed on JDK 21. A newer sbt then hit class file ... AccessFlag.class is broken, because Scala 3.0 cannot read JDK 21 class files. These steps got the lesson running:

  1. Set sbt.version = 1.11.7 in the lesson’s project/build.properties.
  2. Run sbt "++3.3.9!" test to build on the 3.3 LTS line instead of 3.0.
  3. Read the test report: 17 of 19 tests passed in our run.

Both failures are fail() placeholders that the lesson asks you to fill in, so they are expected. Buy the book for the teaching and plan on bumping each Scala 3 lesson the same way. The three Quill lessons stay on Scala 2.13, so leave their Scala version alone and only update sbt. Expect to pay around $18 to $25, far below its list price.

6. Scala Cookbook, Second Edition

Alvin Alexander wrote the book to keep beside you once you write real Scala. It answers “how do I do this?” one recipe at a time.

Scala Cookbook Second Edition by Alvin Alexander book cover
Scala Cookbook, Second Edition by Alvin Alexander. Image: O’Reilly Media.

At 799 pages it is the longest book here. The recipes cover command-line tasks, strings, numbers and dates, control structures, classes, traits and enums, methods, collections, sbt projects and more. The second edition rewrote them for Scala 3 and was released in August 2021.

Its example repository has 35 sbt projects pinned to Scala 3.0, and it hasn’t been updated since September 2021. Expect the same build bumps as Get Programming with Scala if you run them, although we didn’t build these ones. Skip it as a first book, because recipes assume you know the basics. It ran about $35, a large discount on its list price.

7. Effect Oriented Programming

Bill Frasure, Bruce Eckel and James Ward wrote a short book about effect systems. Every example uses Scala 3 and ZIO 2.

Effect Oriented Programming by Bill Frasure, Bruce Eckel and James Ward book cover, using Scala and ZIO
Effect Oriented Programming by Bill Frasure, Bruce Eckel and James Ward. Image: Billding Software.

Published in July 2024, it’s the newest book in this list and the shortest at 154 pages. Effects here mean the unpredictable parts of a program, such as network calls, failures and user input. The book shows how ZIO turns them into values you can test and retry. The examples repository targets Scala 3.5 with ZIO 2.1 and zio-direct, which is far closer to current Scala than the 2021 books.

Skip it if you are still learning the language or your team uses Cats Effect, because every example is ZIO. The Amazon ASIN starts with B0 even though this is a paperback, because the ISBN uses the newer 979 prefix. It ran about $30.

What should you check before buying a Scala book?

Amazon search for Scala books now mixes these titles with Scala 2 editions and with self-published “Scala 3” books that list no publisher at all. A few minutes on the listing and in the repository tell you whether the code matches what you will install:

  • The listing shows the edition number from the table above, not an older one at a lower price.
  • The publisher page or cover says Scala 3, not Scala 2.12 or 2.13.
  • The build file in the companion repository names a Scala 3 version you can install.
  • The repository has a commit from the last year or two, or at least a tag for the printed book.
  • Any library the book leans on (ZIO, Cats Effect, Akka or Pekko) matches what your team actually uses.

Scala is also the language Apache Spark is written in, so data engineers often arrive here first. Our Kafka and Spark book list picks up where these leave off, the data engineering books cover the pipeline side, and you can install Spark on Ubuntu to try the Spark chapters of Programming Scala. Coming from the JVM side, the best Java programming books are worth a look first, and the wider list of programming books covers other languages.

Which JDK and Scala version should you install first?

Install a current LTS JDK and let Coursier install the Scala tools, then use whatever Scala version each build file pins. The Scala download page lists the current Scala Next and LTS releases. We used these steps on Ubuntu 26.04, and our Scala install guide covers RHEL and the other routes:

  1. Install OpenJDK 21 from the distribution packages.
  2. Download the Coursier launcher and run its setup.
  3. Open a new shell and confirm the scala command prints a Scala 3 version.

Install the JDK and Git first:

sudo apt update
sudo apt install -y openjdk-21-jdk-headless curl git

Then fetch Coursier. Its setup installs the scala runner, Scala CLI, sbt and scalafmt in one pass:

curl -fsSL -o cs.gz https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz
gunzip -f cs.gz && chmod +x cs
./cs setup --yes

Our first run was on a Proxmox guest with the default kvm64 CPU type. It stopped with The current machine does not support all of the following CPU features that are required by the image, and the list included AVX and AVX2. Setting the CPU type of the VM to host and rebooting fixed it. The setup then found the JDK and installed every tool. On a machine whose CPU type you cannot change, Coursier documents a JAR-based launcher for the same setup in its installation guide. Check the result in a new shell:

scala --version

The runner reports its own version and the default Scala it compiles with:

Scala code runner version: 1.17.1
Scala version (default): 3.10.0

Leave that default alone and let each book build choose its own version. A repository that pins Scala 3.0 needs bumping to at least the 3.3 LTS line on JDK 21, as Get Programming with Scala showed. A repository that pins a newer release builds as published, which is what we saw with Programming Scala.

Keep reading

Best Machine Learning Books (2026): Textbooks, Python, Free PDFs AI Best Machine Learning Books (2026): Textbooks, Python, Free PDFs Best C++ and C Programming Books for 2026: Beginner to Advanced Books Best C++ and C Programming Books for 2026: Beginner to Advanced Best System Design Books for Interviews and Architecture in 2026 Books Best System Design Books for Interviews and Architecture in 2026 Best OpenShift Books for Admins and EX280 Candidates Books Best OpenShift Books for Admins and EX280 Candidates Best API Design Books: REST, gRPC and GraphQL Books Best API Design Books: REST, gRPC and GraphQL Best Ruby and Ruby on Rails Books Books Best Ruby and Ruby on Rails Books

Leave a Comment

Press ESC to close