Tech and Media Labs
This site uses cookies to improve the user experience.

Scala Overview

Jakob Jenkov
Last update: 2014-05-25

This text is an attempt to provide you with an overview of the Scala programming language and Scala platform. Since Scala is being developed all the time, this overview page may change over time. Additionally, as I learn more about the Scala language, I may add to this text too.

Scala runs on the Java Virtual Machine

Scala is compiled into Java Byte Code which is executed by the Java Virtual Machine (JVM). This means that Scala and Java have a common runtime platform. If you or your organization has standardized on Java, Scala is not going to be a total stranger in your architecture. It's a different language, but the same runtime.

Scala can Execute Java Code

Since Scala is compiled into Java Byte Bode, it was a no-brainer for the Scala language designer (Martin Odersky) to enable Scala to be able to call Java code from a Scala program. You can thus use all the classes of the Java SDK's in Scala, and also your own, custom Java classes, or your favourite Java open source projects.

Scala Has a Compiler, Interpreter and Runtime

Scala has both a compiler and an interpreter which can execute Scala code.

The Scala compiler compiles your Scala code into Java Byte Code which can then be executed by the scala command. The scala command is similar to the java command, in that it executes your compiled Scala code.

Since the Scala compiler can be a bit slow to startup, Scala has a compiler daemon you can run. This daemon keeps running, even when not compiling Scala code. You can then instruct the daemon to compile Scala code for you at will. This saves you the Scala compiler startup overhead when compiling.

The Scala interpreter runs your Scala code directly as it is, without you needing to compile it. The Scala interpreter may come in handy as a Scala script interpreter, a bit like a shell script interpreter on a Unix platform.

Scala Features

Scala has a set of features which differ from Java. Some of these are:

  1. All types are objects.
  2. Type inference.
  3. Functions are objects.
  4. Domain specific language (DSL) support.
  5. Traits.
  6. Closures.
  7. Concurrency support inspired by Erlang.

Scala for the Web

One of the popular Scala web frameworks is called Lift. You can find it here:

Jakob Jenkov

Copyright  Jenkov Aps
Close TOC