A couple of years ago I had never heard of the programming language Scala. Now I write it everyday! This article is for those who don’t know what Scala is and would like a quick overview.
Scala is a relatively new computer programming language. It was first released in 2003 and publicly released in 2004. The founder of Scala is Martin Odersky and he continues to lead the design of the language. You’ll often see him speaking at the major Scala conferences and he’s got a free online course on functional programming if you’re interested.
Martin was and still is an academic at a university in Lausanne, Switzerland called École Polytechnique Fédérale de Lausanne (EPFL).
Scala is a combination of the words scalable and language, because it was designed to grow with the demands of users.
Java Virtual Machine
Scala compiles down to Java bytecode and runs on the Java Virtual Machine. This means that we can run Java alongside Scala in the same project. This is one of the reasons for Scala’s success. It’s not too difficult for those working on Java projects to try Scala.
Moreover, Scala addresses some of Java’s weaknesses. Java is quite verbose, whereas Scala is terse. That can make it harder to read for beginners, but after learning it, this is a huge benefit.
Also, Scala offers us the opportunity to follow the functional programming (FP) paradigm, as well as object oriented programming (OOP).
In functional programming, every function is a value. We don’t mutate an object’s state once it’s created and we write pure functions where the function always outputs the same result for the same given input and there are no side effects.
This style of programming aims to eliminate programme state to make our code less prone to bugs and easier to test.
Learn more about functional programming here.
Scala is a statically typed language and has a type system that enforces this at compile time. This means that variables are assigned types. These types are checked at compile time. This is helpful, because at compile time our types are checked, which can help us to catch bugs.
The compiler can often infer types, so we don’t need to annotate all of our code with types. This can make our code easier to test.
Scala is changing! The latest version of Scala is Scala 3 which was released in 2021. This of course introduces some changes, but Scala 2 code still runs in Scala 3 projects.
Learn about the key differences between Scala 2 and 3 here.
Let me know why you’re interested in learning more about Scala!