Got back into android development recently and while everything was pretty flawless ( I managed to get the basic concepts implemented in a day) something wasn't right.

For some reason I was not happy with the code i wrote, although I took examples from google and tried to adapt their code style. It looked aweful. I hated my code.
But the code itself wasn't the core of the problem. I could easily add new features and replace components with new implementations without breaking the app. All those "good code quality" identifiers were there.

Turn out the problem is Java. Or to be more specific: Java 1.6
Every listener which only calls a single function once a worker has finished needs 6 lines of code. If you implement the inferface in the class it gets messy once there are multiple workers and you have a generic interface. And there are no lambdas!

So I made the switch to Kotlin.
The app was converted to kotlin in 30 Minutes​. Android studio can convert the classes automatically and very little manual work is needed afterwards.
After that I spent 2 hours replacing the old java concepts with Kotlin concepts: lamdas, non-nullable types, getters and setters in kotlin style (which in this case is c# style) and some other great thing.
The code is good looking now. I like it. I like kotlin as it has a lot of cool things.
Its super easy to learn. It took me about 2 hours to get into it. It combines concepts from java, javascript, c# and maybe a few other languages to form a modern jvm 1.6 compatible typesafe language.

Android dev is fun again!

  • 0
    RetroLambda is a nice option if you want to stay in Java. It's not complete, but it's nice.
  • 0
    Android now supports Java 1.8 (if you only develop for fun and don't care for backward compatibility)
Add Comment