As part of my series “An opinionated Kotlin backend service” (to be published soon), I was checking out different ways to serialize/deserialize JSON payloads.

According to these are the supported converters:

I tested #1 and #3 and because I like challenges from time to time I threw Moshi into the mix. I left out Jackson because… well why not ;-).

My test was simple. I wanted to serialize/deserialize this data structure(s):

data class Customer(
var customerUUID: String,
var createdAt: Instant,
var modified: Instant,
var firstName: String,
var lastName: String,
var language: Language,
var account: Account,


As part of my series “An opinionated Kotlin backend service” (to be published soon), I was checking out several libraries to validate client requests.

My requirement was to use a Kotlin library to have a concise and fluent API without the typical Java verbosity (thus none of these made it onto my list:

What I didn’t want (

public class BusinessObject {   @NotNull
private String name;
private String deliveryAddress;
private String invoiceAddress;
@Assert(expr = "_value ==_this.deliveryAddress || _value == _
this.invoiceAddress", lang = "groovy")
public String mailingAddress;

More to my liking (, although it’s…

I agree with Joost Klitsie, the author is holding it wrong ;-). Scope functions are very useful if used properly. Showing bad examples of scope usage and then deducing that scopes make your code less readable is a logical fallacy.

The deleteImage is such a bad example. As Joost already demonstrated, there are better ways to write that code without falling back to the terrible Java like null check. My favorite is:

val imageFile = getImage() ?: return

But this would do nicely too (no scope):

if (imageFile?.exists() == true) imageFile?.delete()

Even using run is better than the Java style…


There are many ways to build, test, deploy and publish an Android app.

You can do it manually. It’s not hard or time-consuming to create a signed APK or Bundle in Android Studio, upload it to Google Play and promote it through the different testing tracks up to production. I did it for many years. I thought the time automation saves won’t compensate for the effort to set up a working pipeline. I was wrong. Automation doesn’t just save time, it also makes the process more reliable, less error-prone (to human error) and encourages to deploy/publish more often. In general…

Combining state design pattern and finite state machine


The state design pattern is used to encapsulate the behavior of an object depending on its state. The state implementation reflects the behavior the object should have when being in that state.

A finite state machine describes a computational machine that is in exactly one state at any given time. It can change from one to another state in response to some input / trigger / event.

The emphasis of the state design pattern is on encapsulation of behavior to create reusable, maintainable components (the states). …

Emanuel Moecklin

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store