April 29, 2020

Going Kotlin

Kotlin Banner

#android  #java  #kotlin

Why choose Kotlin over Java? Wasn't the latter already enough? Kotlin is coming near you!

For someone who has developed Android apps, hearing about Kotlin and not giving it a try would be out of the ordinary, so I, too, started learning it by the end of the last summer. Everything was straightforward apart from the concepts that I hadn't come across before. Overall, I liked the language and wanted to try it. However, I didn't have a suitable project to use it in, so I left it and never put what I learned into practice until today.

I have decided to rewrite one of my apps to modernize the codebase. So with that, it is also high time to move to Kotlin.

Writing in Kotlin will reduce the boilerplate and provide a compatibility layer that ensures the same modern code works on different versions of Java, especially on Android.

The compatibility issue has been there since the earlier versions of the platform, which usually arises when you try to use a feature the platform doesn't support or target a Java version incompatible with your app's minimum SDK version. They have somewhat resolved the issue with the arrival of the Java 8 support and the desugaring library. Still, I say you shouldn't count on those two firmly.

Also, newer libraries are increasingly targeting Kotlin, and you may soon struggle to find code examples that use Java code. So, believe me when I say the exodus has already begun.

Finally, I don't think Kotlin has a steep learning curve. It is just another high-level language like Java. Also, null-safety and all the exclusive features are a plus.