From spring boot to ZIO

Kristof Slechten
4 min readMay 21, 2023

--

This article is a small summary of the personal journey that took me from spring boot to ZIO for some of my development cases. This is not a technical discussion regarding spring boot or ZIO, but a story why I use ZIO as my preferred stack for some of my projects.

I’ve been a java developer when I finished my master computer science many years ago and I switched to become a data scientist before the AI hype.

Although I mainly like data science and applied math, I’m still a software engineer at heart and I believe that a data scientist can also be a good software engineer. I have developed in many languages like java, python, c++, typescript, … but object oriented development was the dominant paradigm. I also believe that you should use the right tool for the job and learning new languages / frameworks have always been an option when I am tackling new types of problems. People evolve / change and languages evolve …

I worked with the first versions of spring, hibernate, etc. and when spring boot came to live, I was amazed … You could setup up a SOAP project in a few hours … The ecosystem, the documentation, the convention over configuration principle, etc were amazing at that time.

The J2EE stack was no longer the default for many customers and Spring (Boot) became the standard for Java development in that period.

As I moved away from Java development, I became a data scientist and I embraced the python ecosystem. The customer for which I’m a data scientist for 5 years now had a Java / Spring / JVM stack for all their web applications and the core of their ERP architecture is an old AS400 system which is still used today and they are slowly transitioning from an on premise data center to GCP.

They don’t have big budgets and occasionally I still get my hands dirty for “non data science” work like Kafka streams, GCP cloud functions, etc. and the customer and my java colleagues prefer one stack and Spring (boot/cloud/etc) is still the way to go for them.

After the rise of Java 8 I wanted to learn a new language and Java 8 learned many things from Scala, so I began reading books on Scala as a hobby, while working in python for my professional data science projects. For some data engineering projects I used Scala / Spark.

I got more intrigued by the benefits of functional style programming after Java 8 and I decided to use functional style scala for some hobby projects and the learning curve was steep but doable. When touching subjects like monad transformers, I felt beauty but I also knew that it was a robust solution for a problem that I didn’t have in my professional context.

Spring and other frameworks dropped support for Scala and integrating java annotations in a scala project was a hell so Scala remained a hobby language except for the Spark use cases.

And then I learned about ZIO and saw some talks from John De Goes and the way you could compose functions, schedule them, retry them, etc. struck my curiosity.

I started to use ZIO for some hobby projects. It gave me that same feeling I had when I first used Spring Boot, but first versions still had some rough edges (lack of documentation, no build in logging, dependency injection was complicated, poor ecosystem, etc) but the good parts were dominating my feeling and I decided to give it a try in a small hobby project and the integration with Java libraries felt more convenient (although I dumped annotation heavy libraries like optaplanner for OR tools to make the integration less painful).

Scala 3 was under development and I saw some preview talks where the “implicit dragons” were tamed with a new better syntax and I liked the evolution of the language (and the python indentation style which is controversial).

In the meanwhile ZIO 1.0 came out and the ecosystem started to grow. ZIO Kafka was a perfect match for some of the small Kafka consumer projects that I needed and I decided to give it a go.

I became more fluent with ZIO and started to expand the use case of ZIO in small projects where concurrency and parallelism matters. The GCP capabilities expanded a lot over time and Cloud Functions are not always the best / only tool for a problem. We are using cloud run, cloud batch, cloud scheduler, cloud workflows, etc and basically the container approach gives freedom and I managed to move away from python / spring boot and use ZIO 2 / Scala 3 for some of the small projects that I personally maintain at our customer and even Java developers in our team are starting to appreciate many aspects like the easy unit testing, the readable functional style, the powerful dependency injection mechanism, etc.

This does not mean that they will ditch spring boot any time soon, but where the spring boot army knife is no longer the best option, I am using ZIO/Scala when working close together with the java team.

I’ve been using ZIO for some time now and even when making a simple REST API service I can honestly say that I personally would also choose ZIO/Scala over Spring Boot since the Scala 3 tooling is finally becoming stable and I prefer the developer experience of ZIO.

ZIO / Scala 3 is not my dominant tool as a data scientist in the python ecosystem but when possible I would always consider ZIO/Scala as an option.

I hope this explains the twitter response that I gave on John his blog post.

--

--

Kristof Slechten
Kristof Slechten

Written by Kristof Slechten

father, husband and data scientist / ml engineer@continuum consulting

Responses (1)