In which I argue the case for Kotlin’s Companion Objects being the Clark Kent of language features, in being deceptively powerful, and how we can use them in creating ways to supercharge our API design.
“Companion Objects are not just placeholders for constants and other static state; they allow for new strategies to help organise our code or to provide reusable factory and validation features.”
Of all the features that developers enthuse about in the Kotlin world, one of the ones that you hear about least is the humble Companion Object. On the face of it, they are merely a…
In which I describe a pattern for writing third party adapters in a modular and extensible way, hoping that it is original enough for me to christen it. 🙃
“Breaking down monolithic remote API adapters into individual Actions sharing a common single-function Protocol interface allows them to not only be more decoupled at the code layer, but also simplifies both testing and extensibility.”
Reader Note: whilst this post is about a pattern that is not Kotlin-specific, it does demonstrate the pattern using code written in Kotlin. This uses various language features such as Data classes, Companion Objects, Operator overloading and…
Engineering Lead // Open Source // Trainer // Speaker // Kotlin GDE // Co-creator of http4k