DEV Community

Discussion on: Google announced Kotlin priority programming language for developing Android applications

Collapse
 
jillesvangurp profile image
Jilles van Gurp

This is increasingly true on the backend as well. E.g. Spring recommends using Kotlin and is adding co-routine support to Spring 5.2, making it the obvious choice to do asynchronous services. The difference with e.g. Scala and other JVM languages is that Kotlin is designed from the ground up to be a drop in replacement for Java. It's easy.

For example, the recent move of OkHttp to Kotlin is interesting since it is used a lot on both backend and Android. v4 was released a few weeks ago, is completely backwards compatible with v3 despite changing the implementation language from Java to Kotlin.

I've ported quite a bit of Java code over the last two years and it ends up being vastly improved with extremely low effort. I usually go class by class: run the automated conversion in intellij, fix the few errors, fix all the warnings and suggested improvements, change a few things to be more idiomatic Kotlin, run the tests, commit. Even very complex classes can be converted with a minimum of investment in time. The harder it is, the bigger the payoff because this usually indicates that there were some dodgy things happening. In my experience it's vastly easier than e.g. migrating js to ts, which I've also done a lot lately and which often ends up being quite hard due to a lack of automated tools and due to the fact that js can be quite messy.