Blog

Tactical Design by Example - Using Kotlin and Spring Boot (Part 12) - Using Kotlin Delegates for Domain Events

Let's talk a little more about behavior vs data today. Imagine modelling a chess game, especially the part where a player makes a move. Behaviour This would be a simple model for making a move that could come up in an Event Storming. The command is the blue sticky, the aggregate is yellow, and the events are orange. When you look at it from a behaviour perspective, there are two different… [read more →]

Tactical Design by Example - Using Kotlin and Spring Boot (Part 11) - Improving Command factories with Kotlin's Result type

Only recently have I come across the Result type in Kotlin's standard library. It's been added in version 1.3. It's a great way to implement a simple Either-like type, something I have mentioned in the previous week. Return nullable type or Result? I built a factory method for a command that returned a nullable type data class UpdateDepositPrice( val articleId: String, val refundPrice:… [read more →]

Tactical Design by Example - Using Kotlin and Spring Boot (Part 10) - Creating Commands with Kotlin's invoke method

I wanted to elaborate on behaviour-centric development, but that didn't happen. Maybe I will get back to that later. Here's something different I have learned recently, the power of Kotlin's invoke method. Revisiting commands In part four I talked about a similar example of a command data class UpdateDepositPrice( val articleId: String, val refundPrice: Int, val currency: Currency, … [read more →]