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.
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:
| Book | Best for | Scala in the code | Code today | Pages | Published |
|---|---|---|---|---|---|
| Programming in Scala, 5th ed. | One complete tutorial | 3.0 | No public repo to test | 668 | 2021 |
| Scala for the Impatient, 3rd ed. | Java developers in a hurry | 3.2 | Worksheets compile, old sbt pin fails | 400 | 2022 |
| Functional Programming in Scala, 2nd ed. | Functional programming | 3.3 | Builds on 3.3, needs one flag removed on 3.10 | 488 | 2023 |
| Programming Scala, 3rd ed. | Moving from Scala 2 | 3.9 | Builds clean | 553 | 2021 |
| Get Programming with Scala | First steps in Scala | 3.0 (2.13 in 3 lessons) | Needs newer sbt and Scala | 560 | 2021 |
| Scala Cookbook, 2nd ed. | Task recipes | 3.0 | Not built | 799 | 2021 |
| Effect Oriented Programming | ZIO and effects | 3.5 with ZIO 2 | Not built | 154 | 2024 |
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:

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
'activebecomesSymbol("active")or, better, a plain string. - A
do { ... } while (cond)loop is gone and has to become awhileloop. - A method declared with
()must be called with(), socountdownbecomescountdown().
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:

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.

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.
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.

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:

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-editionbranch, not thefirst-editionone. - The
//> using scalaline 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.
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.
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:
- Set
sbt.version = 1.11.7in the lesson’sproject/build.properties. - Run
sbt "++3.3.9!" testto build on the 3.3 LTS line instead of 3.0. - 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.
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.
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:
- Install OpenJDK 21 from the distribution packages.
- Download the Coursier launcher and run its setup.
- Open a new shell and confirm the
scalacommand 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.




