Scrolling through Twitter I found this Tweet which I kinda agree with:
Vasiliy Zukanov@vasiliyzukanovThis thread reflects the real state of Android development.
While Kotlin fans are very vocal (even aggressive in some cases), there are LOTS of Android developers who still prefer to use Java and don't understand what's all the fuss about.
reddit.com/r/androiddev/c…19:59 PM - 13 May 2019
I went on to check out the Reddit Post spoken of.
Here is my take on what I saw.
In the Android community, there is this constant battle of Java and Kotlin which, in my opinion, is very unnecessary.
I use both Java and Kotlin and can say that Kotlin is a wonderful language.
But here is the issue, to uplift a language, you do not need to talk down on another. If a tool is solid and stands the test of time, people would adopt it.
Another mistake I see is when people compare Kotlin's current features with Java's past issues.
What do I mean by that?
When people compare Kotlin with Java they, sometimes unknowingly, are comparing Kotlin with Java 7.
In case you are not aware, the latest Java version is Java 12.
The Java used on Android is mainly Java 7 and a little of Java 8. Java 8 features are now being added to Android for developers to make use of.
If you are familiar with Android development you would know that in order to use Java Streams, which was a feature in Java 8 (2014), you would need to be on API level 24 or higher to use it on Android.
For clarity sake, API level 24 is Android Nougat.
Another Java 8 feature (which you can now access on Android) is CompletableFutures which could replace all the lines of your AsyncTask Class with just a few lines of code.
If you have noticed, I haven't spoken of the current Java 12 features. It is possible to see Java 12 code and mistakenly think it is Kotlin, that's how much Java has improved.
I am also a Kotlin fan. If you would like to know more about Kotlin check out the Kotlin in Action ebook.
But being a fan of one language shouldn’t make you an enemy of another.
The common arguments I hear are readability and productivity. If you want to read a great article on why Kotlin does not instantly mean readability and productivity read this article.
Adopting Kotlin does not guarantee you would have happier developers, fewer bugs and skyrocketing profit. In the end, the users/clients might not even know or care about what an If Statement means.
If you are using Java on Android, Awesome!
Also check out RxJava for Android Developers.
If you are using Kotlin, keep it up!
If you wrote the app using C++ and it works fine as expected, great!
If you wrote it using React native, wonderful!
If you wrote it with Flutter, marvellous!
We like shiny new tools. We should also focus on getting the job done and maintainable.
Shorter lines of code (especially when not significant) do not guarantee the project would be delivered faster. Readability is subjective and any statistics on productivity should be based on facts.