Four months ago, I had to learn Scala and be familiar with the language in order to contribute to a large Scala codebase. I was familiar with Java (I spent 4+ years maintaining OSATE while working at Carnegie Mellon) and I thought that it would be somehow easy, quick and painless.

I was dead wrong.

Yes, Scala runs on top of the JVM but it does not mean it shares so much with Java. Scala is a functional programming language and is way more complicated than Java. This is another level of complexity. I started to contribute to a codebase with people writing Scala for 4+ years and use the nice and barely documented features for advanced users. With such a complicated language, the learning curve was very steep and I had to go through it very quickly to be able to produce anything meaningful.

That was hard. But not painful.

I love learning and I had a ton of fun learning a new language.

After three months, I am still learning every day and continue to read about advanced features of the language. But I am now somewhat familiar enough with the basics concepts of Scala that I can be an active contributor in different projects and teach the language fundamentals at my work.

I wanted to share the current state of the resources to learn Scala in 2018. After 14 years of existence, a lot of materials have been produced and I wanted to share what has been working for me.

The Good

  1. Scala The Impatient is a good resource but way too light. It covers only some very basic concepts and you do not see some advanced features that are really interesting. Read it but do not stop there.
  2. The blog post series of Daniel Westheide: The Neophyte’s Guide to Scala. A must-read if you are new to Scala. The examples are great, with many details.
  3. Programming in Scala by Martin Odersky: great resource to go deeper about the internals of the language (how containers work, etc.)
  4. Twitter util all the code developed by Twitter, an early adopter of Scala
  5. The Scala Cookbook by Alvin Alexander.

The Bad

The classes on Coursera are unfortunately not that great. There is a specialization dedicated to Scala and I completed two of the classes in that specialization. I was very disappointed by the content, especially because I love Coursera (and completed great classes on the platform). Some of the assignments do not match the class, the content is often too confusing. This specialization is not free (you need to pay a $50 montly membership), which would be ok if the content was good. Unfortunately, this is not that great and I would recommend to stick with other resources (like the blog posts from Westheide).

Focus on the Functional Programming concepts

One of the best advice I could give is to focus on the principles of functional programming. Do not focus too much on the syntax and other details (such as case class). Just learn and practice functional programming concepts such as:

  1. Monad: this is just a container but a fundamental concept for functional programming. Good article that explains the Monad.
  2. All transformations functions: map, flatMap, filter, drop. Know them. Practice them. RTFM the Scala API
  3. What is tail recursion and understand why recursing other a list with 10,000 elements will not blow up your stack.

Use a good IDE

If you cut meat, you do not use the bread knife. Similarly, when you program in Scala, you do not use vim or emacs. You could but this is just inefficient and a waste of time when great IDE provide a ton of support for understanding the source code and digging into the standard library.

I use IntelliJ and I am regularly discovering new capabilities (and amazed by many features, such as refactoring). There are my two favorite features in this IDE:

  1. If you press the shift key three times very quickly a search dialog appears and you can search for anything inside your project (thanks Adam for the tip!).
  2. Just do command+click or alt+click on a variable, reference, type to go to its declaration. Very powerful to browse and explore code.

Code Repository

I started a repository that contains code samples for Scala beginners. This is a way to share some code with beginners and help newcomers in the Scala community. This code is intentionally over-documented and often explains what the code does step by step.

You can find the repository at: https://github.com/juli1/scala-cookbook

Other interesting discussions/resources

Keep Learning

There is always more to learn! Some ideas to improve your knowledge of Scala: