A Scala journey: from Java boilerplate to Akka neural networks
Scala is turning 20, so let's celebrate! We asked Scala experts to tell the stories of their Scala journeys. Our guest works as a Product Marketing Manager in a team building a Scala IDE plugin
In 2024 Scala celebrates its 20th birthday! For that reason we asked Scala experts to tell us about their Scala journeys. Our guest works as a Product Marketing Manager in a team building a Scala IDE plugin.
How did you first come across Scala, and what was your impression of it?
Around 2013, I was a Java developer working as a JIRA administrator and web tools developer at an IT company. I built JIRA plugins and a few web apps with quite a lot of logic, used internally by the company. “Logic-heavy” is the crucial word here – unlike many other typical backend Java jobs, my web apps had to carry out complex tasks, crunch numbers, show statistics, deal with numerous corner cases, and so on. I was the only person on the project, so I could write the code the way I wanted – which meant keeping it simple – but at times it felt like I was wrestling with the language. This was still Java 7, and every tiny bit of logic required a pile of boilerplate. I recall that at some point I began writing my own half-baked functional collections with methods such as “foreach” and “filter”, just so I wouldn’t have to keep writing “for” loops that looked nearly identical.
That is how Scala caught my attention – a language with exactly the collections ecosystem I was after, and a syntax that let me express in a few lines logic that took up an entire laptop screen in Java. I was never very interested in the more complex abstractions. I chose to learn Scala because it is an efficient and pragmatic programming language.
Tell us about the moment you thought, “Aha! Scala is awesome!” Which features and capabilities of Scala gave you that feeling?
Well, I hold an MSc in Artificial Neural Networks from a technical university. I didn’t get many opportunities to work in that field, but for years I had been carrying around an idea for an artificial neural network that would function quite unlike any other. Rather than layers, it would consist of neurons running in parallel as actors, each linked to just a handful of others, jointly carrying out a particular task. They would respond to input signals and treat the time gap between them as extra information.
Then I found Akka. It was the ideal framework for building my idea. Much of what had stopped me earlier – having to work out how the neurons would run on separate threads and talk to each other – was already provided. All that was left was to write the interesting bits. So I did. And it worked. Afterwards I gave a talk about it at a Scala conference in 2017. The project was only a proof of concept, and I never took it further. Even so, it got my “foot in the door” when I applied for a professional Scala job, and it led to all my later talks at Scala conferences.
I suppose this could also answer the question, “Tell us about a time when Scala proved to be a game-changer in a real-world project,” even though my project wasn’t exactly “real-world.”
How has Scala shaped the way you tackle programming problems?
In a few simple yet very recognizable ways. Immutability is my default, and I use pattern matching rather than if/else whenever I can; instead of writing interfaces and implementing them, I write methods that take functions and pass functions around, and I chain data transformations. Even when I go back to Java, I sometimes carry on coding this way.
If you could add a new feature to Scala, what would it be, and how would developers benefit?
Async/await in the standard library. It is about time there was a single implementation, so that everyone can spend their energy on something more useful than reinventing it every few years.
What is your favourite programming meme?
There is a whole series of programming memes built around a normal distribution curve: on the left a simple guy or a beginner, on the right an expert/hacker, and in the middle a programmer in tears. The beginner wants to do something in a simple or naive way; the crying programmer is furious because he believes it is far more complicated and has to be done in an elaborate way; and the expert, once again, wants to keep it simple. I think there is a bit of wisdom in it.
Which tools and libraries do you reach for first as a software developer?
The standard collections library. Play, when I was building a web app. mUnit for unit tests. uPickle for JSON. Possibly ANORM or Slick for dealing with SQL queries, though it has been a long time since I last did that. I also have a small library of my own for event streaming and parallelization.
How has the Scala community influenced your programming journey? Any memorable interactions or stories of support?
Almost as soon as I became a full-time Scala developer, I began speaking at Scala conferences. I got to know lots of brilliant people, very skilled and passionate about what they were building. I could take part in those projects and suggest my own ideas, but it soon became clear that my main contribution would come not from programming but from writing and speaking about programming. I concentrated on preparing interesting talks for Scala conferences, launched a small YouTube channel of my own with a series on the basics of functional programming, and since joining a developer tools company two years ago I have moved from a developer role to something between a product marketing manager and a developer advocate – I look after our relationships with Scala developers around the world.
What would you tell someone who is just getting started with Scala?
Concentrate on the fundamentals: the collections library, functions as data, pattern matching, dealing with errors and corner cases using Option and Either, laziness, Future, and so on. Libraries and frameworks appear and disappear. With solid foundations, you can pick up whatever comes along quickly.
Where do you see Scala heading over the next decade?
Scala will remain a fairly niche language for those who want more than Java gives them. I see an opportunity there – showing Java developers that Scala can be a sound alternative, both as a career path and as a technology that blends easily into a Java project for greater safety and productivity.