Scala Overview

Scala — short for Scalable Language — was created by Martin Odersky and first released in 2004. It runs on the Java Virtual Machine, compiles to JavaScript (Scala.js) and native code (Scala Native), and fuses two programming styles that are usually taught separately: object-oriented and functional.

Why Scala Exists

Odersky had already worked on javac, the Java compiler, and on generics for Java. Scala grew out of a simple bet: what if a language combined Java's object model with the expressive power of functional languages like ML and Haskell, and ran on the same battle-tested JVM that already powered the enterprise world?

  • Everything is an object — including functions, which are first-class values you can pass around like any other object;
  • Static, inferred types — the compiler catches whole classes of bugs before the program runs, but you rarely have to write the types yourself;
  • Interop with Java — every Java library, and every Java class, is usable from Scala with no wrapper code;
  • Conciseness — idiomatic Scala is often a fraction of the length of the equivalent Java.

Two Paradigms, One Language

Scala does not force a single style. You can write it almost like Java with classes and mutable state, almost like Haskell with pure functions and immutable values, or — most commonly in production code — a pragmatic blend of both.

Example (the same idea, two styles):

// object-oriented: mutable state behind methods
class Counter {
  private var count = 0
  def increment(): Unit = count += 1
  def value: Int = count
}

// functional: no mutation, a new value each time
def increment(count: Int): Int = count + 1
val history = (0 to 3).scanLeft(0)((acc, _) => increment(acc))
println(history) // Vector(0, 1, 2, 3, 4)

The JVM Foundation

Scala source compiles to the same bytecode Java does. This one decision brings a huge amount of value for free:

BenefitWhat it means
Library ecosystemAny Maven/Gradle Java library is a direct dependency away.
ToolingThe JVM's profilers, debuggers, and monitoring tools work unchanged.
PerformanceDecades of JIT compiler optimization apply to Scala code too.
PortabilityRuns anywhere a JVM runs — the same jar on Linux, macOS, or Windows.

Scala 2 vs. Scala 3

Scala 3 (released 2021) simplified the syntax, redesigned implicits into clearer given/using clauses, and added optional braceless, indentation-based syntax. Scala 2 remains widely deployed. This roadmap teaches core language features that work the same way in both versions, and calls out Scala-3-only syntax where it appears.

Where Scala Is Used

  • Big data — Apache Spark is written in Scala, and its native API is Scala-first;
  • Backend services — companies like Twitter, LinkedIn, and Netflix run large Scala codebases;
  • Financial systems — the combination of strong types and JVM performance suits high-stakes, high-throughput domains;
  • Distributed systems — the actor model (Akka/Pekko) and functional-effects libraries (Cats Effect, ZIO) are native to the Scala ecosystem.
Where to go next: Setup & Toolchain gets a Scala compiler and REPL running on your machine in a few minutes.