Immutable classes in Java and Kotlin
If we write code that runs on more than one thread, sooner or later we meet the idea of immutable classes. The lack of ‘write’ functions makes them very useful in multi-threaded applications. In this article I’m going to show what immutable classes are in Java and Kotlin. We will also look at the practical […]
Java records vs Kotlin data classes
Records and data classes are two very similar types of classes in Java and Kotlin. Despite almost the same look and feel, there are also a couple of differences between them. Recently, I had a chance to try out records after writing exclusively in Kotlin for almost a year. In this article I would like […]
How to abuse Kotlin extension functions
Today we’re going to discuss Kotlin extension functions. It’s a mechanism that allows adding new functions to existing classes that we can’t normally modify (e.g. because they come from another library). Calling an extension function looks like a regular function call on an object. Kotlin isn’t the first language that offers them. Only in JVM […]
Avoid too many function arguments
Code maintainability is a set of guidelines that help making our software easier or cheaper to maintain in long term. It is a cognate to the clean code which is about being able to understand other’s code. Today, I’m going to talk about avoiding too many function arguments. I will show how it translates to […]