My Way to Scala — part 2

How I moved from Java/Frontend to Scala

In the previous post, we featured interviews with three SoftwareMill-ers who moved from Java to Scala. This time you can read about the experience and advice of people who moved not only from backend but also frontend technologies to Scala.

Scala programmer for 5 years. Previously a Java developer for 4 years.

Why did you decide to switch to Scala in the first place?

I was a C++/Java developer when I decided to switch to another programming language. When I first discovered Scala I thought it’s just a better Java-like C and C++. It turned out that Scala was a lot different. Scala was demanding so the entry threshold was high. It took me a while to decide whether I want to build my career in Scala or not. But looking back I realized that I switched to Scala mainly because it is a very concise programming language that shares many paradigms (it’s both Object-Oriented and Functional) and at the same time it all works on JVM. I knew I wouldn’t have to learn everything from scratch.

Describe your journey to Scala. How did it start, and how do you keep learning today?

When Java 8 came out I learned a few functional programming techniques like functions as first-class citizens, option type, streams, etc. I started reading more about Functional Programming in general. Then I came across Haskell but as its community was quite small at the time I knew it would be hard to find a job as a Haskell Developer. I didn’t stop digging and finally bumped into Scala. It was 2013. I attended Scalar 2014 organised by SoftwareMill and after the conference, I already knew that this would be my next programming language.

I started learning Scala by joining Martin Odersky’s “Functional Programming Principles in Scala” course on Coursera. I also started thinking about changing my job. A colleague told me about SoftwareMill and a couple of weeks later my hiring process started. I’ve been part of SoftwareMill for almost 5.5 years now. I learn something new about Scala almost every day. We organise #ScalaBasics workshops for new people joining our team. We also have weekly Friday Markets. These are online workshops usually about Scala language or some other tools that are written in Scala, like doobie or Cats.

And last but not least, we help each other learn new things by organising pair-programming sessions or by asking someone more experienced for a code review.

What was most difficult in the process of moving to a new language?

I was writing code in C++ and then in Java 7 for many years. For me, the most difficult part of the process of learning Scala was to stop thinking in an Object-Oriented way and to start thinking in a more Functional way. Also, understanding abstract concepts like Monads, Functors, Applicatives wasn’t that easy.

How did SoftwareMill help you in the process?

SoftwareMill is a part of the Scala ecosystem. They organize Scalar conference, release many open-source libraries like Scala clippy, Reactive-Kafka (now Alpakka-Kafka) that help developers in their daily work. Their ambition is to gather most of the best Polish Scala developers in one place. These people helped me a lot particularly in understanding Scala and its quirks. They showed me how to change the mindset from an object-oriented to a functional one.

What would be your advice for people thinking about learning Scala?

Scala can be a bit overwhelming at the beginning so my advice is to start slowly, step by step. If you’re a Java developer, first try writing Scala code in a bit “Java-like way”. That way you get a good understanding of how it works and your code will get better and better. Most of us write CRUD web applications so maybe a good starting point would be to take a look at: https://github.com/softwaremill/bootzooka. It’s a simple project that lets you quickly start developing a Scala-based web application, without the need to write login, user registration etc. Take part in good Scala conferences, like Scala Days, Scala World and Scalar. Talk to people and share your knowledge. Good luck!

He started programming in Scala 5 years ago. Previously a Java developer for 8 years.

Why did you decide to switch to Scala in the first place?

Back then Scala was a very promising language. It had all the things out of the box that in Java you would need a dedicated library (e.g. things from guava). What’s more, the syntax was succinct and really powerful. I knew there is also a functional part, but I wasn’t familiar with it. I did Martin Odersky’s courses on the Coursera so FP part was no longer a mystery and I was eager to try it in a real-world project.

Describe your journey to Scala. How did it start and how do you keep learning today?

I started with Martin’s courses and then I used Scala for the first time in Bootzooka (SoftwareMill’s library for quickly starting a Scala-based microservice or web-app). I continued to learn it in various commercial projects, but I wasn’t using its full potential from the start. My first code had a more objective approach with functional parts (it was reactive), then, after some time, I started using more and more functional parts. By the way, I’m still a bit skeptical about using some functional concepts such as Tagless Final in the domain code, however, if I would write a library it’s a reasonable choice.

I read Scala Times and attend Scala conferences such as Scala Days or Scalar. I have plenty of challenges in my daily work, so I keep on learning every day.

What was most difficult in the process of moving to a new language?

Switching your brain from objective to functional thinking was most challenging. Sometimes, I still get confused with functional code, but maps, flatMaps and folds are my good friends now. Besides that, a new language means a new eco-system. I have to mention SBT, which is a very simple tool unless you need to do something custom during your build process. A few years ago Intellij IDEA support for Scala wasn’t perfect as well so I learned not to trust my IDE. Something “in red” might turn out being completely correct due to Scala compiler (and the other way round).

How did SoftwareMill help you in the process?

I had an opportunity to be a part of Scala projects from the very beginning. There were people within the company that already had a couple of years of experience so I could lean on their experience. Besides that I remember times when half of the team was doing Martin’s courses on Coursera, so you had lots of people around to discuss the lectures and exercises.

What would be your advice for people thinking about learning Scala?

Don’t be afraid, start with the objective-oriented part and discover how nice and simple the syntax could be. Then start adding some functional elements one by one. Don’t dive deep if you are not familiar with the FP e.g. too much Cats or Shepless might blow your mind.

Don’t overcomplicate things, try to stick to the KISS principle. If something could be done with one line of code, it doesn’t mean you can’t split it to make it more readable tough.

If you feel a bit overwhelmed with all that FP toys, that’s a good sign. Carry on. Your brain needs to adapt, but after some time you will get used to it.

Is there anything that you miss from the Java ecosystem?

A speed of compilation and IDE support 🙂