Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "android java code quality"
-
!rant
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!2