From first principles: Why Scala?

Click for: original source

Scala, first appearing in 2004, is neither an old stalwart nor a new player in the programming language market. This post will discuss the unique combination of features that Scala provides and how it compares to other languages on the market, diving beneath the superficial experience to explore the fundamentals of the language. By Haoyi.

Scala combines object-oriented and functional programming in one concise, high-level language. Scala’s static types help avoid bugs in complex applications, and its JVM and JavaScript runtimes let you build high-performance systems with easy access to huge ecosystems of libraries.

The article’s main sections:

  • User-facing selling points of the Scala language
  • A compiled language that feels dynamic
  • Hybrid languages
  • Why use a hybrid language?
  • Easy safety and correctness
  • Functional programming
  • A broad and deep ecosystem
  • All in on Static Analysis
  • Inference for ease of use

… and more. Scala more than most languages focuses on static compilation and analysis. Almost all Scala language features are resolved statically, with even the “monkey-patch”-esque extension methods and implicit conversions implemented at compile-time rather than runtime.

At small scale, the personal preference between static typechecking doesn’t matter. At larger scale, the lack of static typechecking is a huge pain point for anyone maintaining a system. While that was not so clear in the past, today we can see every dynamic language adding support for static typing.

Scala is a language that scales well from one-line snippets to million-line production codebases, with the convenience of a scripting language and the performance and scalability of a compiled language. Scala’s conciseness makes rapid prototyping a joy, while its optimizing compiler and fast JVM runtime provide great performance to support your heaviest production workloads. Very nice!

[Read More]

Tags scala app-development code-refactoring programming functional-programming