Kotlin Native
February 20, 2020  |  

I’ve been using Java for many years and there is nothing wrong with using it for most of the use cases. The problem is, I work on Android apps quite a lot, and it’s a very fragmented platform. Developers are forced to use ancient Java versions in order to be compatible with as many Android devices as possible. Kotlin is a kind of “hack” that allows developers to use many productive language features that simply aren’t available if you use Java.

Another noteworthy thing about Kotlin is its native support for coroutines which makes front-end development much easier. Concurrency is hard and Java concurrency is not an exception. There are alternative solutions that allow developers to avoid using native concurrency API, but they usually destroy code readability by turning codebases into a hacky mess. In my opinion, coroutines allow developers to produce concise, easy to read code that can be read top-down, like a book. I believe that’s a big advantage.

Those two selling points are enough to convince me to use Kotlin, at least on Android. Interestingly, Kotlin ambition seem to be much bigger than that. Kotlin Native, another interesting Kotlin initiative, had started to get some traction lately. I wouldn’t speculate much about this, but I generally like the idea of sharing the “core logic” but doing UI via each platform’s native toolkit. Many companies tried to go cross-platform and the results were unsatisfying (DropBox, AirBnB, etc). The main reason, in my opinion, is a poor choice of language and attempting to create a cross-platform UI (a la Silverlight many years ago).

Here is the example of a hybrid architecture that I find interesting, although it’s probably not production grade yet.