Making Scala and functional programming more accessible in REA

In REA, we have a list of highly sought after internal courses available on various topics including AWS, Docker and Elasticsearch. On 7th and 8th May 2018, we added Scala to the list, with over 20 people attending!

How did this all start?

Scala and functional programming have always had some mystique surrounding it. There is this idea that it is too hard or not pragmatic enough. Existing courses are very technical and many people including myself have struggled to complete them.

I strongly believe that Scala and functional programming makes you a better engineer, regardless of the area or technology that you work in. It can make you write better code in Ruby, it can make you write better log messages, it can make you craft better systems, etc.

I know that there is at least some interest in the organisation when it comes to functional programming, especially because our FP Guild pulls between 10 to 30 people every week. Unfortunately, the existing resources available aren’t working for a certain audience.

In my mind, the majority of engineers here work with non-trivial technology all the time: Docker, AWS, Elasticsearch, etc. Luckily, we have really strong internal training available for these technologies. As a result, we are able to work successfully using these technologies. Prior to joining REA two years ago, my Docker and AWS skills were non-existent. Today, I work with Docker and AWS every single day.

How can we learn from this and make Scala more accessible to everyone?

An internal course, of course!

An expression of interest was sent out on Slack back in February 2018, looking for volunteers to help organise the course as well as interested attendees. In a couple of days, we had over 30 names in the list!

My initial proposal was a two day Scala course: day 1 covering Scala fundamentals and day 2 covering how to build a web app. As I started working on the material, I quickly realised this was not feasible. A catch up with fellow organisers Sanjiv Sahayam and Chris Myers made us pivot and focus on a two day fundamentals course. Let’s focus on the beginners to start with.

We had some goals in mind…

There were a few things we wanted to achieve in this course:

  • Demystify Scala / functional programming
  • Demonstrate the usefulness of a powerful type system
  • Cover enough of the fundamentals so attendees can understand and contribute to Scala projects
  • Introduce concepts only when needed
  • As useful as it is to understand how a common data structures are built, we did not want to focus on building common data structures in this course, we wanted to show how they can be used
  • Anyone that knows how to program at all should be able to complete most of the course

For three months, we worked on the material. We had a lot of help from the volunteers and a few guinea pigs who were happy to spend some time trialing our material. Volunteers and trialists continually submitted pull requests to our material at all hours of the night. It gave the training material an open source collaborative feel and a great sense of community.

How did the day look?

We made a conscious decision to invite a diverse group of attendees (we had a delivery lead, systems engineers, quality assurance engineers, data scientists, etc.) and also organised a group of presenters with different levels of seniority and background. Scala is for everyone!

Day 1 – Language basics, functions, types, algebraic data types

We figure it would be appropriate to kick the day off with a presentation by one of the very first people to write Scala in REA. Chris Myers‌ started day 1 with a presentation, covering some history and the motivation behind functional programming in Scala.

The rest of the day was language basics. Felipe Flores and Ashok Ramdoss presented on functions, algebraic data types and also how to work with Lists in a declarative manner.


After attending a YOW! Night talk by Manuel Chakravarty, Sanjiv suggested that it is important to show pain points before showing the solution to a problem. This means instead of showing how we deal with values that may not exist in a nice functional way, we had to spend some time to show the pain points of using nulls.

We managed to convince one of our early guinea pigs for the course material Tya Cao‌ to show the problem with nulls and introduce the Option data type in her fifth week in REA.

Day 2 – Lots and lots of error handling!

A big part of Scala is treating errors as values and with the respect that they deserve. Chris kicked off day 2 recapping the Option data type and introducing the Either data type.

We continued to work through error handling exercises. Again, we followed Manuel Chakravarty’s recommendation to demonstrate why exceptions can be difficult to work with before showing the Either data type.

In the spirit of showing problems before solutions, attendees learned map first while working with data types, then realised the need to flatten their structures, before we introduced flatMap. This allowed us to transition to showing for comprehensions as syntactic sugar for flatMap and map. It is more time consuming, but I believe that this provides a gentler learning curve and also teaches the why along with the how.

Lastly, we finished the day off with Stilianos Menelaou‌ walking us through a “real world” exercise of writing a Log Parser. The exercise was meant to use the techniques learned in the two days.

My observations

I was really glad to see that people were able to follow for the majority of the course. One of the attendees had failed to learn Scala twice before this (through other avenues) and was able to complete over 90% of the exercises!

A handful of people blazed through the exercises especially on day 1. Instead of moving faster, we decided to stick to the schedule that we had planned for. We wanted to make sure everyone was able to follow most of the exercises. Hopefully we did not leave anyone behind!

We created a digital board to gather feedback over the two days. This allowed us to continuously improve during the course and make sure that the content was engaging and relevant.

REA provided morning and afternoon tea for both days. Having food during the breaks created a social hub for people to gather and chat. It allowed the presenters to gather feedback and also answer questions.

What’s next?

We sent out a survey after the course and found that there is a lot of interest in a more advanced course. We will work towards an Applied Scala course some time, but in the short term I want to try and run this Fundamentals course quarterly at a minimum (we have over 40 people in the waitlist currently!). I’m hoping that we can get attendees from the first course to present the next time we run it. With the number of modules we have in the course, it is a good opportunity for people to grow as presenters.