My Way to Scala — part 1

How I moved from Java to Scala

Scala is the programming language we specialize in at SoftwareMill. That doesn’t mean our team consists of only Scala developers. We hire Java and frontend programmers too. With time some of them seamlessly migrate towards Scala benefitting from the know-how and experience we share internally. If you think you might want to start your own adventure with Scala, then this post is for you. Read the thoughts of SoftwareMill-ers who successfully switched to Scala and make your own first step.

Moving from Java to Scala

He’s been programming in Scala for 6 years. Previously a Java developer for 6 years.

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

My main motivation was just to write simpler code. Initially, I wanted to keep my Java design style, but with much less boilerplate, elegant collection operations, and capabilities of writing fluent tests. Only later, after diving deeper, I found a whole lot of additional reasons, like powerful ways to deal with concurrency, flexibility in defining abstractions, and rich type system that, together with functional programming patterns, allows achieving much better code correctness expressed within the design itself.

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

It all started before I joined SoftwareMill. I discovered Scala through some conference talks and blog posts. I wanted to experiment with it and I managed to smuggle this language to some tests in my Java project. At first, the process of learning was pretty difficult, because I was on my own, and online resources weren’t that rich at that time. I got up to speed later, at SoftwareMill, where I joined a full-time project and got support through code review and mentoring. Today I keep on learning by reading blog posts and joining occasional in-company presentations and workshops.

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

In the case of Scala language, there were a few difficult stages. First — the tooling. Six years ago I was used to a rich set of tools around the Java ecosystem. While for Scala there was just some minimal and buggy IDE support, and not so many helper tools for coding assistance (linting, formatting, etc.). Another difficulty was switching the mindset to a functional paradigm. Next frontier — concurrency and effects. Scala offers great potential in this area, but it takes a while to learn how to properly stack these abstractions together.

How did SoftwareMill help you in the process?

I got lots of support through a code review and general mentoring from a more experienced colleague when I joined a Scala project. It really boosted my learning process. The company also encouraged me to go to Scala conferences where I was able to explore new trends and talk with highly regarded library contributors. Finally, SoftwareMill helped me to join advanced functional programming training.

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

First: start with your test code, where it’s safer to experiment. Second: have at least one more person engaged in learning, it makes the process way more robust. Don’t get scared by fancy FP constructs, first get familiar with plain Scala and its general principles. For example, go to Scala Center website and look for their learning materials, I wish I had it all available when I was starting my journey.

Is there anything that you miss from the Java ecosystem?

Sometimes I miss fast Java compilation, but Scala is getting better and better. I guess it’s still a fair tradeoff anyway. IDE support also has a bit to catch up, however, it’s very decent now and with projects like Metals I have no doubt it’s a matter of time. The last thing is a more uniform community — there are some divisions that don’t serve the development of the ecosystem.

She’s been a Scala programmer for 4 years. Before starting her Scala journey she had been coding in Java for 8 years.

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

SoftwareMill is well recognized in the Scala community. As a result, while working here, I kept seeing clients approaching us with interesting projects, searching for Scala engineers. That sounded like an interesting way to learn something new and become a better professional along the way. I was also curious to try functional programming and see for myself if its way of dealing with distribution, asynchronicity and state as good as it promises to be.

Describe your journey to Scala. How did it start, how did you learn it, how do you keep developing yourself today?

I started by reading a book on Scala. Or maybe even two. I got the basics then, but still felt far from confident in the language. So I tried doing the Coursera course but quickly discovered that this type of learning is not for me. Finally, I found colleagues at SoftwareMill who agreed to help me out through mentoring and that was a breakthrough. Having this possibility of frequent pair programming, code reviews and discussions when I got stuck with something, was simply invaluable. It was only when I saw how the things that I had once seen as abstract mathematical ideas are used in specific project scenarios, that it all really clicked with me. Nowadays I usually learn by reading different blog posts (also on SoftwareMill tech blog) about the concepts, libraries or patterns that I have come across and haven’t known yet. There’s a lot of that, and the list never seems to shrink…

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

It was for sure the loss of fluency in writing code. I had been used to a certain pace of programming, when the lines of code smoothly followed the thoughts and ideas in my head. Suddenly, it was all gone. It seemed to me that I stumbled with every step I made. What idiom should I use here? What kind of structure? Should this be a case class or a trait? How to join the pieces together? And what was I trying to do here anyway? I remember that it was a very frustrating phase.

How did SoftwareMill help you in the process?

I don’t think I would make it if it weren’t for my colleagues. Apart from the mentoring that I mentioned before, we also have a #scala channel on Slack, where everyone is always happy to help. I went there with all kinds of questions, like “what on Earth is this compiler error supposed to mean”, “how to refactor this monster to become a nice, readable piece of code”, or “what is the name of that funny ASCII operator that is so hard to search for in Google”. I was never left alone.

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

Go for it, but — I’d recommend making sure you’ve got the right support beforehand. You’ll have lots of questions and blockers along the way. It saves a lot of time when you can ask a real person about it.

Is there anything that you miss from the Java ecosystem?

Not on a daily basis. But sometimes, when I struggle to understand some concept or have a hard time googling some arcane operator, I do miss Java’s verbosity and some nostalgia kicks in :)

He started programming in Scala 6 years ago. Previously a Java developer for 7 years.

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

I was working in Java (mostly in JavaEE) for several years back then and was looking for something fresh, a better way of doing things, some new paradigms, etc. These were times when all the FP thing wasn’t really known for regular Java developers. I started digging in, reading and it turned out to be the perfect addition to my toolbox back then.

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

I was unable to use Scala at work due to some organizational constraints so I was learning it in my free time. I started with a Coursera course led by Martin Orderski (creator of the language). I was doing small pet projects but I was still lacking more real-life experience with the language. Shortly after that, I decided to start looking for a new job and one of the goals was to find a company where I would learn new things and preferably work in Scala. And that’s how I joined SoftwareMill. That was a trigger for learning new things and expanding my knowledge as I got a chance to work in Scala on a real project. Since then all JVM-related projects I’ve been working on were in Scala.

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

Despite popular opinions on the Internet, Scala is not a difficult language to try. It’s mainly because of its seamless compatibility with Java and the kind of dual nature (Functional Programming vs Object-Oriented Programming). You can get your hands dirty just by starting to write Java-like code in Scala. The immediate benefit you get is the conciseness of code. The first thing that you leave behind are types’ annotations as Scala can infer most of these. At the same time, you can still write code the Object-Oriented way as you are used to doing in Java. Then you start learning about immutability, collections and digging deeper into the more functional way of doing things. With newer Java versions it’s even easier as some of the functional programming concepts are already present there and you might be familiar with them (e.g. lambdas). Finally, once you get hooked you dive deep into FP which turns out to be a complex and endless journey :) But you’re still free to fallback to your Java/OOP style of coding whenever you need that.

How did SoftwareMill help you in the process?

It helped a lot. I joined a regular Scala project right from the start which was exciting and very demanding on the other hand. But as we all in IT love learning new things it was not a big deal to me. What was most important is that I wasn’t learning Scala on my own. I got support from highly Scala-skilled coworkers in the company (even though the language wasn’t that popular yet). I could always reach out for help and get some tips & tricks over the course of my journey. Then the popularity of the language has grown, a lot of skilled people joined and Scala has become our main backend programming language here at SoftwareMill.

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

Don’t be afraid of all these functional programming “incantations” and terms you don’t understand at first. If you come from Java you pretty much know Scala already (but in its OOP flavour). You’ll get better every day and your mind will seamlessly shift to thinking more Scala way. Get an online course (the famous Coursera one), then the next one, learn the ecosystem. Throw a Scala compiler into your project if you can. And if not, try joining a Scala project as there is no better way to get the real experience.