This is why you should learn Scala

- select the contributor at the end of the page -
Whether you're tired of writing boilerplate code, struggling to maintain your code or just eager to learn something new, you should get to know Scala. Scala is an open-source, multi-paradigm language (functional/object-oriented) built on top of the JVM , and it lets you write expressive code with ease. As code becomes more expressive, it begins to mirror the business requirements, which also increases maintainability.

I would go as far as to argue that it's the top alternate language to Java on the JVM, and I'd be in good company.  Even Groovy's creator, James Strachan, points out just how great it is in his blog, "I can honestly say if someone had shown me the Programming in Scala book by by Martin Odersky, Lex Spoon & Bill Venners back in 2003 I'd probably have never created Groovy."

So, what makes Scala so great?

Let's start with the language itself. It's modern; it takes advantage of type inference, allowing you to write code like this:

val company = "Pluralsight"

This feels dynamic, yet keeps compile-time type safety. Then there's the fact that everything in Scala is an expression, which allows you to write this code:

val ifResult = if(someBoolean) "true" else "false"

Expression-based coding means that you can take the return value of an “if” statement and store it directly, with no need to create a variable until the end of the evaluation. This makes your code read more like your train of thought.

Now that you've seen a couple of snippets, you may have noticed the decrease in unnecessary code ceremony; return values are implicit, semicolons are optional, as are dots and parentheses in most cases. And, what about those pesky null reference exceptions that always seem to be fighting? Scala combats them with Options, classes that wrap objects in a way that they're type-checked as to whether the code is handling the empty state. (You are given the power to override this type safety; however it's not encouraged.)

Another great feature of any language that touts the functional flag is pattern matching support:

myList match {

case List() => “The list is empty”

case first :: second :: restOfList => s”The list has at least 2 items: $first and $second”

case first :: restOfList => s”The list has at least 1 item: $first”


This extremely contrived example exhibits how easily you can decompose objects using pattern matching. All of this is just a small taste of Scala. To learn even more, head here.

In the realm of frameworks and tooling, the utilities available for Scala are ever growing. There's a framework to build web applications called Play! and a functional ORM via Slick. There's also big data processing through Spark, and Akka is an easy framework you can use to introduce yourself to simple, scalable parallelism using the actor design pattern. This is just a sampling of the frameworks available to Scala, but what about the tooling?

Scala installs with a REPL, so that you can play around with the language and learn through immediate feedback. Then there's the de facto build tool for Scala, sbt, which comes built in with the typical build tasks of many development teams (compile, test, run, publish). And, of course, there is IDE support via both IntelliJ and Eclipse. In fact, both tools have a built-in REPL, called the worksheet, to get the REPL's quick feedback without ever needing to leave the IDE.

You even get access to all existing Java frameworks if your existing development is in Java. That's because Scala is binary compatible with Java, so any existing Java utilities don't need to be thrown out. In fact, you can add new Scala into your existing Java codebase, without needing to ditch anything. This interoperability along with the functional/OO combination of Scala means that it can be eased into your development stack.

Mostly, you can write code as you're used to writing it, and add in the Scala functionality as you feel comfortable. Scala lets you dive as shallow or as deep as you need to get the job done. Another tool available to get up and running quickly is the activator. This browser-based utility provides you with numerous templates that act as tutorial-like launching points.

Now, you might be wondering how this level of support is possible for an open-source language. It's in large part due to Typesafe , a company co-founded by the language's inventor, Martin Odersky. Its goal is to provide enterprise-level support for this burgeoning language and its growing ecosystem.

In fact, Typesafe plays a big part in the reactive manifesto, which is a driver towards writing scalable, event-driven, responsive, fault tolerant applications – Scala and its ecosystem make this job easier. Then there's the other function of Typesafe; providing training and consulting services, which helps to expand the reach of Scala into enterprise companies like Twitter, LinkedIn, IBM, Amazon, NASA, Netflix, Foursquare and Paypal.

Here's the best part: All of this is just scratching the surface. As you dive deeper into Scala, you'll likely find yourself disliking parts of your day-to-day language, especially regarding verbosity. The language allows for the creation of beautiful DSLs, and its already large ecosystem is growing daily. Github statistics show that Scala is one of the top 20 languages used for open-source projects.

And really, you have no reason not to give it a shot. Not only can Scala help boost your resume, but its focus on maintaining Java interoperability lets you try the language with zero risk. Couple that with the founding of Typesafe, and even enterprise companies can make use of Scala without some of the normal worries of other open source languages.

Learn more in my new course, Scala: Getting started.

Get our content first. In your inbox.

Loading form...

If this message remains, it may be due to cookies being disabled or to an ad blocker.


Justin Pihony

is a passionate software journeyman who loves to spread that passion and knowledge. He writes a lot of C# code, but is diving deep into Scala's beautiful language.