Structured concurrency: will Java Loom beat Kotlin’s coroutines?

Kotlin and Java Loom: structured concurrency for the masses

Java, as slow adopter of new concepts is getting structured concurrency as part of the Loom project. This addition enables native support for coroutines (termed virtual threads) in Java. What does that mean for Java & Kotlin developers? Should we now all transform our existing code bases to support virtual threads? Or even jump back to Java?  We compare two approaches to do structured concurrency on the JVM: Java Loom’s virtual threads and Kotlin’s coroutines. As it turns out, Kotlin coroutines show to be more developer friendly, while Java Loom might have its sweet spot as part of Java libraries and frameworks. Want to know why? Buckle up, as we have a lot to talk about!

Read more →

An alternative to exceptions in Java: validations, pt. 1

Exceptions in Java are inconsistent due to their special handling. They are like a separate flow of information, which not only claims extra resources of a developers mind, but also comes with a lot of boilerplate code and high likelihood of new bugs. Instead of exceptions, errors can be handled with »validations«. The underlying concept of a validation offers an effective and consistent approach to error handling and data validation. Even though validations are more than capable of handling any kind of exception, I will focus in this post on data and result validation.

Read more →

The complete picture: Lagom and Play in action (Java)

If you ever came across Lightbend, the driving force behind Scala and Akka, you might also have heard about Lagom and Play.

Lagom and Play fall into the category of reactive microservices. I’ll not go into detail about this, there are plenty of resources out there (e.g. here and on a broader perspective, here). The most important takeaway is that you can build a microservice architecture with Lagom. Play complements Lagom as it provides the web-framework that serves content to the user using Lagom’s microservices in the background.

What puzzles me, though, is that Play and Lagom are handled in isolation when searching for information or going through the tutorials (at least that is my experience).

How can you combine Lagom and Play to set up a complete system?

Read more →