Chapter 1. Zero to Sixty: Introducing Scala
Let’s start with a brief look at why you should investigate Scala. Then we’ll dive in and write some code.
Why Scala?
Scala is a language that addresses the needs of the modern software developer. It is a statically typed, object-oriented, and functional mixed-platform language with a succinct, elegant, and flexible syntax, a sophisticated type system, and idioms that promote scalability from small tools to large sophisticated applications. So let’s consider each of those ideas in more detail:
- A Java Virtual Machine (JVM), JavaScript, and native language
-
Scala started as a JVM language that exploits the performance and optimizations of the JVM, as well as the rich ecosystem of tools and libraries built around Java. More recently, Scala.js brings Scala to JavaScript, and Scala Native compiles Scala to native machine code, bypassing the JVM and JavaScript runtimes.
- Object-oriented programming
-
Scala fully supports object-oriented programming (OOP). Scala traits provide a clean way to implement code using mixin composition. Scala provides convenient and familiar OOP consistently for all types, even numeric types, while still enabling highly performant code generation.
- Functional programming
-
Scala fully supports functional programming (FP). FP has emerged as the best tool for thinking about problems of concurrency, big data, and general code correctness. Immutable values, first-class functions, code without side effects, and functional ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access