My Scala Story

I have been reading the My Scala Story series by Software Mill - a short interview of renowned experts about their Scala journey. I have not done anything substantial in the OSS space to be on Software Mill’s radar. But their series inspired me to share mine. So, here it goes …

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

Around six years ago, I was tired of programming in the mainstream imperative languages - C++, Java, C#, Python, and the like. I was not interested anymore in writing loops and such. I wanted to program on a higher plane (functional style)

I had begun exploring Scala. The syntax instantly impressed me - concise yet expressive. The language dropped every bit of conventional and redundant syntax, which cuts to the chase. Types were the central idea. That got me hooked on Scala.

Also, I wasn’t particularly interested in developing pet projects but wanted to use it as my primary language. Luckily, my new job at the time was Scala-based, which set me on a course to never let go of Scala.

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

Without second thought, it is the implicits, which extend to type classes. Implicit gives you a whole new model of defining dependencies. Typeclasses threw away conventional inheritance out of the window.

In particular, recursive implicit resolution was my Aha! Scala is awesome moment.

How has Scala influenced your approach to solving programming problems?

Scala was my gateway into functional programming. It taught me to develop an intuition to abstract and establish/use abstraction patterns. In contrast to object-oriented languages, functional abstractions/patterns cannot be discarded as subjective because they are backed by proof. Functor laws, for instance.

The other big influence for me is the idea of declarative lazy style. You describe/declare your program but do not execute it until you have declared it fully. It is a powerful idea that brings up nice patterns. To explain this idea to newcomers, I use punched cards (or mainframes) as an example. You write your program fully and submit it for execution. Despite being a funny and loose example, it gets the message across. 🤷‍♂️

What is your favorite programming meme?

Microservices - Show user their birth date

Not a meme, a real talk but really funny: Top 5 techniques for building the worst microservice system ever - William Brander - NDC London 2023 - YouTube

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

Tell us about a time when Scala proved to be a game-changer in a real-world project.

I worked on a project not so long ago. We had to inspect the parameters for sensitive data before persisting. Two important requirements:

Let me say that again - compilation error if the user has not provided the logic to strip sensitive data for a given type. Instant feedback!

Implicits, custom string interpolator, type classes and a couple of other Scala features made it possible. It is hard to imagine if it is possible to implement such an elegant solution in other languages, especially with ingenuity of Scala syntax/features.

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

Some wonderful people I love interacting with:

There are other great people in the community I have interacted with ; briefly or for long. It is hard to list all names.

Caveats:

I mentioned caveats in the middle to highlight the following. There are a lot of great people in the community that I admire for two reasons; especially those I mentioned above:

Generally speaking, I have had a pleasant experience in the community so far.

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

A couple come to mind.

What advice would you give to someone just starting with Scala?

Scala is an incredibly powerful and expressive language. You can bend it to the extent you want. Once you get a hang of the language, it is hard to let go of it. The initial days might be challenging. You might struggle to get a hang of implicits, typeclasses and functional principles in general. However, there are a number of wonderful resources for beginners. From books and courses to people in the community who are happy to help you.

Here is a short but incomplete list of ones that top my list:

Beyond the resources listed above, you will come across numerous fantastic resources. Don’t forget to share them.

How have you seen Scala evolve over the years?

If you are coming from another language, especially the mainstream imperative ones, Scala 2 should be a big enough upgrade. It should already influence in the way you think and write your programs.

Scala 3 is not just another version but feels like a new language. No, I don’t mean like a ton of breaking changes. Watch Michael Pilquist’s fantastic talk to know what I mean. Scala 3 has been under incubation (or however they call it) for a long time before it went GA. Like well-aged wine (or cheese)! Type level programming using macros, Dependent Types, Polymorphic Function Types, Type Lambdas etc. are some of the features that take you to whole another way of writing code, which is foreign and impossible in many mainstream languages. And may even be considered unnecessary!