Adam Warski - My Scala Story
Scala turns 20 years old! Congratulations to all of the language contributors and enthusiasts - what a journey that is...
We invited Scala experts to share their Scala Stories. Adam Warski is a Scala & Distributed Systems Expert, CTO and co-founder of SoftwareMill, OSS Developer.
How did you first get introduced to Scala, and what did you think about it?
I first saw Scala during my master’s studies in 2005 or 2006, when one of the students presented it at a seminar. My reaction was: we have Java, and we have OCaml (the languages I used back then), why would we ever need Scala? Obviously, that was (one of) my “640K is enough for everybody” moments, though luckily, nobody asked for my opinion then ;)
Tell us about a moment when you realized, "Aha! Scala is awesome!" What Scala's features and capabilities made you feel that way?
Fast forward to 2010, I was a Java programmer and a firm believer in JEE, CDI, annotations, and the like. But Scala was gaining popularity, and it somehow came on my radar. Having really fond memories of Functional Programming from my time at the University (where, as mentioned above, I worked a lot with OCaml and Scheme), I started using it for side/personal projects.
The earliest one I could find is the “conference portal”. Back then, each IT conference had its web app, and Confitura wasn’t worse! The 2010 edition was backed by an app written using LiftWeb, with comet-generated dynamic content. I think it worked out quite well!
One feature of the conference portal that I’ve been particularly proud of is the pre-conference voting by attendees on which presentations they would like to see. We then generated a schedule using what is now called OptaPlanner with a minimum number of conflicts so that the schedule would fit everybody’s preferences as much as possible. Once the world rediscovers this idea, remember that Confitura had this in 2010! ;)
How has Scala influenced your approach to solving programming problems?
I think this approach was shaped mainly by the education that I had the opportunity to receive at the University of Warsaw, where the “functional” style was really popular. So, using Scala allowed me to use in practice what I consider the better way (at least for me! Not necessarily universally) of writing and structuring programs.
One thing that always stood out in the Scala community is the multitude of fresh ideas and approaches on how to solve problems due to Scala's flexibility and elegance. It’s an incredible learning experience, but it also teaches you to cautiously approach fashions (which is a fact in every programming community).
We've had some:
IO monads, free monads, tagless final. Now, “direct style” is often mentioned (including myself). Trying to thoroughly understand where a particular approach is coming from and in what ways it is better or worse than the current approaches really helps you grow as a programmer. At least, that’s what I’m trying to do, also through my blog posts and conference talks!
But, one thing that does come to my mind in how Scala influenced my approach to design is a general technique (but often used in Scala code) to represent various concepts and problems as values. We can see this in the
IO data structure, in tapir’s
Endpoint, or sttp’s
Request. This way we get an additional degree of flexibility in how we can interpret the data. Of course, this technique is not always applicable, but it’s good to have it in your toolbox. Scala’s flexibility in modelling abstractions and elegant syntax you can achieve to manipulate such an immutable structure play a crucial role here.
If you could add a new feature to Scala, what would it be, and how would it benefit developers?
I think I’d have quite modest needs. The first thing would be to give better explainability of
givens. As a feature, they’re great and one of Scala’s founding features, but if the wrong implicit is used, or an implicit can’t be found, they might be a pain to debug.
Ideally, I’d like to have a way to see how an implicit value for a given type is derived (should be one click / shortcut in the IDE). IntelliJ Idea has this feature, but it works, I think, about 50% of the time. So it’s going in the right direction, but not quite there. But secondly, I’d also like to somehow query the compiler (and see in the IDE!) to explain to me all the derivation paths that have been tried but failed. Anything that helps to understand “why is my implicit not used here” would be great.
The second feature would be around tooling. SBT is the best build tool I know, especially coming back occasionally to Maven or the like. If you need to automate something in the build, it’s possible. Plus, it’s possible without using YAML. But also, SBT is slow - which is a pain, especially when you reimport the project into the IDE frequently.
What is your favourite programming meme?
Of course, “this is fine”.
How has the Scala community impacted your programming journey? Any standout interactions or support stories to share?
I know the Scala Twitter/X community doesn’t have the best reputation, but it has been a great source of knowledge and inspiration throughout the years. I only follow a handful of people, but through tweets & retweets and among the many non-IT-related tweets (which I mostly ignore), there are really interesting discussions and thoughts. Plus, Twitter (now joined by Mastodon) is a great discovery mechanism for interesting reading material in our field!
To name a few people that I think have been most relevant here (in no particular order) would be Rúnar Bjarnason, Alex Nedelcu, John de Goes, Viktor Klang, Konrad Malawski, Li Haoyi, Jon Pretty, Paweł Szulc, Debasish Ghosh, Daniel Śpiewak and many others!
What advice would you give to someone just starting with Scala?
Oh, that’s simple - generate your first project with https://adopt-tapir.softwaremill.com/ and try hacking away :)
What are your predictions for the future of Scala in the next decade?
I have no idea, but so far, Scala has been pushing the envelope, and I hope it continues to do so. We can see that many of Scala’s innovative ideas have been validated, e.g., by including them in Java (pattern matching, immutable data structures, string interpolation, etc.), so we’re definitely heading in the right direction. I’m really curious about where capture checking and the results of project Caprese will take us.
On the other hand, Scala 3 has solved many of the problems that have been painful in past releases. We now have LTS releases, binary compatibility guarantees, simpler implicits, typesafe macros and inlines, opaque/union/intersection enum types, and more. I think we still have a lot of discovering to do as to how best use these features to write elegant, efficient, maintainable and understandable code.
SCALA is celebrating its 20th anniversary!
We're marking this milestone in style, so be sure to keep up with #scalaversary on X and Mastodon. Plus, don't miss out on the Scalar Conference 2024 – it's going to be a Scala Fiesta! Join us for an action-packed two days filled with functional programming insights, led by a vibrant community of IT professionals. It's your chance to network with like-minded individuals, gain expert knowledge, and forge new friendships.
Secure your spot now and we'll see you in March!