A Scala journey – from Java to type-safe domain modelling
Discover our developer's Scala story – how she started, how she got really good at it, the tools she loves and more!
In today’s instalment of our special series for Scala’s 20th anniversary, a seasoned Software Developer working with our company tells us her Scala story!
When did you first come across Scala, and what was your impression?
When I came to our company, I was a Java developer, but it didn’t take me long to see that a company with so many Scala projects and Scala experts was a great chance to learn something new with people around to back me up. Initially, the language struck me as really hard, all the more so because I was simultaneously trying to get my head around the principles of functional programming. I kept wrestling with all sorts of concepts and language constructs. This tough stage went on for a good while, and it was only after I joined a project alongside a more experienced colleague, who supported me constantly and pair programmed with me, that things at last began to “click” for me. I could finally sense that I was moving forward, that the language wasn’t holding back my coding, and that I was genuinely productive. Ever since, writing Scala code every day has been a joy – although I do still run into the odd frustrating moment!
Describe a moment when you thought, “Aha! Scala is awesome!” Which of Scala’s features and capabilities gave you that feeling?
I recall a pair programming session fairly early on in my Scala journey, when I was having a hard time figuring out the right types and methods to get my code to compile. My pair programming partner said: “Relax, it’s hard, but once your Scala code finally compiles, it will usually just work”. At the time I didn’t quite believe it, since no other language had ever given me that experience, but I quickly found out that this really does happen quite often! That made me fall for the language and start seeing the compiler not as an adversary but as a friend working alongside me to find the right solution. What I love most about Scala, even now, is its strong type system and the ability to model the domain so that invalid states simply can’t be expressed in the types.
Another moment that stuck with me was when I was trying to make a piece of code as elegant and readable as I could, so that someone new would immediately understand my intent. At some point I thought, “It would be great if this type had a method called such-and-such. Hang on – in Scala, I can make that happen!” Right then, adding a type class to extend a closed type solved a genuine need I had while writing that code. I still remember how proud I felt that day for having written such beautiful code!
In what way has Scala shaped how you tackle programming problems?
Thanks to Scala, I fell in love with functional programming, and it has been my favourite way of writing code ever since. I like breaking a problem down into lots of small, manageable steps. In functional programming, these small steps are functions that are easy to understand and test, and which are finally composed together into the complete solution.
Which programming meme do you like best?
Definitely this one:
Image source: imgur.com
I can really relate to it, and I love that feeling of building an intricate mental model of the algorithm when I’m in the zone, coding.
Which tools and libraries do you reach for first in your work as a software developer?
Vim and IntelliJ IDEA are my two favourite tools, and I bring them together through the IdeaVim plugin in IntelliJ. What I love about Vim is that I can code as fast as I think, with my fingers staying on the home row and no need for arrow keys to move around the code. As for IntelliJ, I appreciate how hard it tries to keep pace with what developers need; I keep finding new tool windows and features, so I seldom have to switch windows while coding, which means fewer distractions – and these days that’s always welcome.
What role has the Scala community played in your programming journey? Any memorable interactions or stories of support?
I’m certain I wouldn’t be a Scala developer today without the community. I’ve always felt strongly supported while learning. For one thing, I kept coming across endlessly patient mentors who helped me with my daily Scala struggles. For another, attending Scala conferences and meeting so many people passionate about the language has kept my own enthusiasm and drive for continuous learning alive. And then there are the countless blog posts, videos and Stack Overflow answers that have always been available to help me at every step.
What tips would you give someone who is just getting started with Scala?
My advice is to find a mentor or a more experienced colleague. I’ve been fortunate to have that kind of support, and I doubt I’d have made it through the early frustrations of learning both a new language and a new programming paradigm without it. Books and videos matter too, of course, but I often noticed that with real, everyday Scala puzzles I sometimes couldn’t even phrase the right Google query, because I didn’t know what I was missing. In those situations, a quick pair programming session was not only far faster but also left me feeling that the pieces were truly falling into place and that I had a much better grasp of the language idioms.