Contents

Nicolas Rinaudo - My Scala Story

Nicolas Rinaudo - My Scala Story webp image

The My Scala Story series continues! Today, Nicolas Rinaudo, Scala Developer, author, and sole maintainer of a few useful OSS libraries, such as kantan.csv, is sharing his thoughts with us!

How did you first get introduced to Scala, and what did you think about it?

That was a while ago! I had been mainly doing Java professionally for close to 15 years, was getting a little tired of always applying the same solutions to the same problems, and was looking for something new and challenging.

Being familiar with the JVM, I started looking at JVM-based languages and found Scala. While looking at some code samples, a friend looked at my screen and told me to give up. Scala was far too complicated for me.

So obviously, I took that as a personal challenge, dove into the language with an energy I might not otherwise have had, and fell in love with it.

Tell us about a moment when you realized, "Aha! Scala is awesome!" What Scala's features and capabilities made you feel that way?

The first feature that made me feel the language was really fun was one that I essentially never use or feel the need for - trait linearisation. In my Java years, I often encountered problems that I would have loved to solve with multiple inheritance, which is, of course, not possible. Trait linearisation makes that possible by providing a deterministic way to resolve conflicts in inherited members, which I felt would open an entirely new world of solutions for me!

In the end, though, I've never needed it. Other features, such as Scala's version of type classes, have removed the problem entirely, making solutions to it irrelevant.

Algebraic Data Types is the one feature that truly blew my mind and has had a lasting impact on how I write code, whatever language I use.

How has Scala influenced your approach to solving programming problems?

Scala influenced my approach to programming by introducing me to the concept of Algebraic Data Types.

I really enjoy using Algebraic Data Types as my primary tool for problem-solving. It's straightforward: define the problem with ADTs, create functions to transform them step by step, and you're good to go. I love how ADTs make it easy to model data and think about problem-solving as a data transformation process.

If you could add a new feature to Scala, what would it be, and how would it benefit developers?

That's a tricky question to answer. The main feature I wanted when Scala 2 was state of the art were GADTs because while they were sort of supported, they broke down as soon as you tried to do something a little fun - try implementing a type safe printf and scanf in Scala 2 for example, and the compiler basically gives up.

Scala 3 has mostly solved this - maybe entirely by now? In the past, when experimenting with Scala 3's GADTs, I encountered some odd issues, but the maintainers have been diligent in resolving the problems I reported. It's quite likely that full support is now in place. If that's the case, I'm not entirely certain about additional features I'd require from Scala. Perhaps something akin to Rust's borrow checker for managing resources and their owners?

What are your go-to tools and libraries when working as a software developer?

Nowadays, I actually try to keep my dependencies to a minimum. If I can write a project without a single external library, that's an absolute win.
Of course, some libraries consistently make their way into my builds: cats, for example, mostly when I feel a sudden urge to sequence or traverse things. Or circe, if I need to do something JSON - which, let's face it, is far too often these days.

I've been simplifying my set of tools lately. Part of it stems from the frustration of spending more time fixing tools than they save me. Metals, for instance, is great when it works but turns into a nightmare when it doesn't. Ultimately, I found that, for my needs, I'm better off without it. Now, I primarily use SBT for builds, scala-cli for experimenting with quick ideas, and Emacs for everything else.

How has the Scala community impacted your programming journey? Any standout interactions or support stories to share?

These days, I spend a lot of time speaking at conferences and helping train less experienced developers. It has completely shifted my approach to problem-solving and programming. Now, I aim for solutions that I can explain to beginners or, even better, solutions that a beginner can glance at and say, "obviously, how else would you solve this?"

Blame it all on the Scala community! A few years back, I attended Scala.IO, which was quite a lot of fun. Someone from the organizing team suggested I prepare a talk for the next event. Writing the talk was a bit of a struggle, taking almost a year. But I did it, submitted it, got accepted, and that's when I discovered my love for public speaking.

My first experience with public speaking was quite intense. I gave a talk in French on the issues and design errors I saw in Scala, along with workarounds. As I set up in the room, I noticed about 20 attendees, but it felt like 2,000 in my mind. To add to the pressure, in the front row, right corner, sat Martin Odersky, the creator of Scala. Initially terrified, I reassured myself that the talk was in French, a language he presumably didn't speak, so I should be fine.

However, a few minutes in, Martin raised his hand, politely pointing out a misunderstanding I had about a feature. That's when I discovered he spoke French, and it made the situation more nerve-wracking. The rest of the talk continued similarly, with me being gently corrected while struggling to reach the end. The part where I explained what a type class is was especially challenging. Martin, once again politely, asked me to start over, stating that although I understood it, my explanation was confusing.

Despite the nightmares I had before going on stage, there's a happy ending. Martin invited me to submit the talk to ScalaDays, and I've been speaking at events ever since.

Did you have any hilarious or embarrassing moments while learning Scala?

Oh, there are tons of embarrassing moments. One that stands out, because my team gave me grief about it for months, is that after I'd spent a solid hour explaining how the compiler would check pattern match exhaustivity in the absence of guards, we had a sudden production outage because one of my pattern matches wasn't exhaustive. That's when I discovered how dangerous extractors could be.

PS Don't forget to secure your ticket for the coolest celebration of Scala's 20th anniversary - SCALAR 2024!

2024 cover scalar

Blog Comments powered by Disqus.