Episode 537: Adam Warski on Scala and Tapir
Adam Warski, the co-founder and CTO of SoftwareMill, discusses Scala programming and the Tapir library. Scala is a general-purpose JVM language, and Tapir is a back-end library used to describe HTTP API endpoints as immutable Scala values. Host Philip Winston speaks with Warski about the implications of Scala being a JVM language, the Scala type system, the Scala community's view of functional vs. object-oriented programming, and the transition of the ecosystem from Scala 2 to Scala 3. The Tapir discussion explores why Tapir is a library and not a framework, how server interpreters work in Tapir, how interceptors work, and what observability features are included with Tapir.
Adam Warski, the co-founder and CTO of SoftwareMill, discusses Scala programming and the Tapir library. Scala is a general-purpose JVM language, and Tapir is a back-end library used to describe HTTP API endpoints as immutable Scala values. Host Philip Winston speaks with Warski about the implications of Scala being a JVM language, the Scala type system, the Scala community’s view of functional vs. object-oriented programming, and the transition of the ecosystem from Scala 2 to Scala 3. The Tapir discussion explores why Tapir is a library and not a framework, how server interpreters work in Tapir, how interceptors work, and what observability features are included with Tapir.
Show Notes
Related Links
- Episode 418: Functional Programming in Enterprise Applications
- Episode 266: Charles Nutter on the JVM as a Language Platform
- Episode 171: Scala Update with Martin Odersky
- Episode 62: Martin Odersky on Scala
Other References
- Other Scala Libraries
- Java
Transcript
Transcript brought to you by IEEE Software magazine.
This transcript was automatically generated. To suggest improvements in the text, please contact [email protected] and include the episode number and URL.
Philip Winston 00:00:16 Hello. This is Philip Winston for Software Engineering Radio. Today I’m here with Adam Warski. Adam is a co-founder and the CTO of Software Mill, where he is an expert on Scala and distributed systems. For over 10 years, Software Mill has used Scala and other technologies for custom software development. Adam is also the founder or key contributor on a number of open-source projects, including STTP client, STTP Tapir, Enverse, Quick Lens, and Elastic MQ. Adam has a master’s degree in Computer Science from the University of Warsaw. Today we’re going to discuss the Scala programming language and the Tapir library. Let’s start just by defining each of these briefly. Let’s start with Scala. What is Scala, and when did you personally start using it?
Adam Warski 00:01:04 So I started using, well, I first encountered Scala back in my university days on a seminar on functional programming. It seemed to be quite a weird and partly obscure language back then. I was like on the second year, so I was quite young. Nevertheless, it was quite interesting. But that was like my first, first time when I saw the language. Then I got into Java as a paying job and we started a company. So about like probably eight years later we got our first paying project in Scala, and Scala was way more popular already back then. So, it was this time it was a conscious decision to actually try out something new, and by luck or by choice — well probably half-half — we ended up using Scala. And you know, there’s nothing better to learn a language than actually writing code in that language. And so, thanks to that client and to the openness of that client to us trying out a new language, we managed to learn quite a lot and that’s how we started.
Philip Winston 00:02:07 Can you give me some examples of problem domains where Scala is particularly well-suited, either that you’ve worked on or just from the communities or the precedent for using Scala?
Adam Warski 00:02:18 Well, Scala is a general-purpose language, right? So, you can, in theory at least, write anything using Scala. That said, at least in our company, we mostly use Scala on the back end. So, we use it again as a general-purpose back-end language. So, any kind of APIs, data processing, distributed systems, stuff like that. In the community, Scala is also very popular in the Spark project, through the Spark project. However, we don’t do that much data science ourselves, so that’s not where we use Scala. That’s also the possibility of using Scala on the front end through Scala JS. But that’s also not a domain that we’ve been exploring too much. So, in our case, it’s mostly the backend, it’s mostly business code. We found Scala to be very flexible in the way we can define abstractions and the way we can express various domain concepts.
Adam Warski 00:03:17 So, when using other languages — so, we’ve used Java a lot as well — so very often you were able to express various domain concepts in the language, but they were intertwined with some infrastructure code, right? So, the domain concepts sometimes drowned among all the infrastructure and all the boilerplate that you needed to define as well. So, with Scala it’s much easier to define the abstractions, which allow you to actually make a clear boundary between your business code and your infrastructure code. So, then it’s crystal clear which one is which, right? And this makes it easier to read the code and to understand it, right? If you have the domain concepts fleshed out quite clearly, it’s quite easy to understand how things work. And then if you have the infrastructure separate and the abstractions separately, it’s also easier to understand how the whole thing is orchestrated. So I guess, yeah, that’s, that’s our main use case for Scala.
Philip Winston 00:04:12 So talking about back end, is some of your use cases e-commerce or telecommunications, or like, what specific domain?
Adam Warski 00:04:21 We don’t really focus on any particular industry. The problems tend to be very similar as far as back-end development goes, right? It’s the same problems, maybe the words a bit different, right? So, the domains are different of course, and the business people express their problems using different vocabulary, but in the end, on the technical side, you end up writing more or less the same things. That’s why we don’t really, we are very technical-focused company. Our specialty is not on an industry, but on the technical side. So, as I said, you know, back-end distributed systems and so on. That said, a lot of our clients do come from some specific industries. So, we’ve had a couple of clients from telco and we had some clients from medtech. So medical, we had a couple of clients from the entertainment industry and of course fintech is the fourth large group. So, I guess you can say that I know maybe they, these are industries which have these kind of problems particularly often, but without any special focus that’s what we’ve seen projects being in a similar industry.
Philip Winston 00:05:27 Let’s also briefly talk about Tapir, and then we’ll dive back for about half the show into Scala and half into Tapir. But I just want to let people know where we’re heading. So, what problem did you set out to solve with Tapir? And if you can mention the STTP family of libraries, where does Tapir fit into that?
[...]