Kotlin API design extension function

Write extension functions for your own classes in Kotlin

A recent question on Kotlin’s Reddit came to my attention lately: 'Why is it bad to write extension functions for classes that you own?' One of the answer was that it was the opposite: it’s a good practice, and for several reasons. Among them were two very important ones that improve the design of one’s code: Able to call the function on a nullable. For a class with generic types, add a function that is only available when a specific type is used.

CI CD

There's no such thing as CI/CD!

Recently, I became aware of a trend that has been growing since too long: conflating CI and CD into the same word group - CI/CD. When this is done by marketers, this is business as usual, a mix of buzzwords and hype that shouts 'Look at me!'. But when this is repeated by professional software engineers, I start to worry. And this is exactly what’s happening right now. This post is meant to be a snapshot of my thoughts that I can refer others to in order to dispel the confusion I believe is

Docker design

Composition over inheritance applied to Docker

This post is neither a recommendation, nor even a suggestion. It’s just me toying with an idea: Implement it at your own risk! The main benefit of Docker containers is that they are self-contained. For developers, that means one just needs to inherit from the desired Docker image that contains the necessary required dependencies, and presto, one can build one’s application deliver it to production. Most of the times, the process is pretty straightforward. Containerization allows

web attribute request session

Easier attribute management in Java EE

Last year, I’ve been tasked to design a course and teach it to students of the 3rd year of a higher-education school in Geneva. Though I’m a Spring fan, foundations of Spring’s Web MVC take their root in Java EE e.g. servlets and filters. For this reason, I created the course on Java EE. I started my career with Java and J2EE 1.3. By reading the documentation again, I learned a few things regarding the changes since that time. This post is dedicated to one of my findings: how

conference tips

Advices for junior conference speakers

Some years ago, I started my journey on the conference circuit. I did that on my own, in my free time. Without mentorship on how to do that, and with my gut feeling as the only guidance, I made plenty of mistakes…​ and I still regularly do. However, I now have a couple of hard-earned experience years behind me. Note that conferences are IMHO just a subset of public speaking in general. Meetups are another form, with a different set of constraints and challenges. However, I believe c

ServiceLoader module

Migrating the ServiceLoader to the Java 9 module system

A long long (long?) time ago, I wrote a post about the ServiceLoader. In short, the Service Loader allows to separate an API and its implementations in different JARs. The client code depends on the API only, while at runtime, the implementation(s) that is (are) on the classpath will be used. This is great way to decouple the client code from the implementing one. For example, the ServiceLoader is used by SLF4J: one adds the slf4j-api on the classpath at compilation time, while any single impl

Docker industrialization ONBUILD

ONBUILD, the overlooked Docker directive

It’s hard to ignore Docker nowadays. There are a lot of blog posts available on the Web. The problem is that most always repeat the same. In this post, I’d like to focus on one directive that I find overlooked via a use-case: it is Java specific, but the parallel can be easily drawn to other tech stacks. The problem The situation is the following: as a developer, I’d like to use Docker as a way to package a JAR from the sources of my application. As a reminder, here’

hibernate query JPA persistence

Hibernate's Query-By-Example

Despite the current trend regarding &nbps;ORM frameworks, I never had any issue using JPA nor Hibernate. I must admit that my use-cases were pretty simple. Also, since that was already some years ago, we hosted those applications on our own on-site infrastructure so that the search for the ultimate performance - and its associated savings - was not a goal; empowering junior developers who were not familiar with a lot of technologies was. Interestingly enough, Hibernate actually predates JPA, so