loading...
Cover image for The funny Java vs Kotlin battle

The funny Java vs Kotlin battle

lemuelogbunude profile image Lemuel Ogbunude ・2 min read

Scrolling through Twitter I found this Tweet which I kinda agree with:

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.

Happy coding!

Posted on by:

lemuelogbunude profile

Lemuel Ogbunude

@lemuelogbunude

Software Engineer. Founder of Lemubit Academy. I love Jesus Christ and I love people.

Discussion

pic
Editor guide
 

Well said! Languages are tools. The tools are either suitable or less-than-suitable for a given problem domain.

Java and Kotlin are both very mature, successful languages, on JVM which is an amazing platform. (And the IDE tools available with the refactoring power is jaw-droppingly wonderful.)

I sort of liken the Java/Kotlin battle like the Java/C# battle. Same story, once again. Java on JVM is successful, with wonderful tools. And C# on .NET is successful, with wonderful tools.

Which tool to use, for which platform, really depends on the problem trying to be solved and for what target audience, and with what kind of deployment model.

Everything in the top 50 of the TIOBE Index charts is easily a winner, as a reflection of the industry.

 

I would say where Java failed for the last 20 years Kotlin successed. Java should make it easier to write programs. folks are coming up with wrapper over java to solve a lot of coding challenges faced by programmers.
Scala gave it the first shot and now Kotlin which is using the best things from scala and python.

Spring framework is also now is promoting Kotlin. If it goes like this mostly folks will move away from core java programming and will start using Kotlin.

once the project graalVM is fully operational than folks would want to use Kotlin more than java as it will more portable and similar to another programming language.

 

I couldn't agree more!

Also, the battle is kinda healthy for the languages to keep up and not slack.

 

I completely agree with you. I used Java for a long time, and Kotlin was a breath of fresh air. Especially since we can't use Java 9 and above on Android. However, I had moments where I was solving a given problem in Kotlin and thought "Eh, this would've been easier/more straightforward to do in Java", and that's OK. Both languages have their pros and cons, but ultimately both are means to an end. People seem to easily forget that we could already do amazing stuff with Java, long before Kotlin even existed.

 

Exactly. You have spoken the truth.

 

I love Kotlin, and it introduced me to a whole new set of features i could not have dreamed in java(altough java is not lagging behind anymore). But let us not forget that if Kotlin is so great is mostly because Java JVM , libraries and community are great. And Java isnt going anywhere

 

It's too much this vs that in software and it's only getting worse lately. Take for example C# it's like Kotlin guys. Just hate the Java all the way and compare previous issues with current features of opposite program. And it's worse on global scale now FP vs OOP. Well in case FP people forgot a lot of things they use are built with OOP style. Although on both sides there are people who start this talk down on "opposite" side in my experience it's usually anti-Java people and FP people who start useless discussions.

Comparing things is extremely useful for learning but why think it's the only approach if you like it? This is kind of getting religiously extreme. Scala is good example how to p**s of everyone. It's useful it provides both FP and OOP and does not exclude something just because some programming ideology think it's bad it lets you make the decision. It should be also with the languages and tech in general. The best programming language/paradigm, framework, OS... is the one that gets the job done (or the one that makes you more money :D )

 

I agree with this. I also prefer Kotlin at the moment and get to use it at work but do feel like Java gets pooped on a lot.

It's not that bad I'm fine with it but I definitely would rather use Kotlin over it at the moment.

That said, like you also mentioned. I haven't even tried java 10+ yet. It's getting better but I don't think it's there yet.

 

Yes, Kotlin is really nice.

Unfortunately, as you said, some people talk down on Java more than is needed.

 

Kotlin does sound really cool. I personally haven't tried it yet.
When it was decided to do an Android app for our graduation project, my colleague suggested using Kotlin, but I thought we should leverage our knowledge in Java as it was the first language we learned at university and the one we took the most courses in, and it has served us well!

 
 

Great I develop with kotlin,I will comment that it fantastic nonetheless Java is quite good and has a strong community.The developers of both languages do not need to panic because they similar and easy to switch my advise is that it better to work smart than hard

 
 

Well said sir. I agree. I have been using Java and Kotlin both now for awhile and I have to say that I don't prefer one over the other and of I did I would not speak negatively of the other. It serves no purpose to condemn a language because you use/like/love a different one.

 

Hello you are right.
Kotlin is great and Java is good.

In fact the thing that made Andorid looks extra bad to me is Android.

And more specifically the way the Android team taught us to do Java.

  • Java 7.5
  • No typesafety anywhere
  • Lots of bad recommendations in the name of performance
  • Enums were supposed to be avoided (remember?)
  • God objects that do everything
  • Poor API designs
  • Poor Android documentation

So Java on Android as taught by Google sucks a lot.

Java itself deserves our praise

 

Streams and lambdas are awful in Java 8. Completable Futures are... ok, but way more complicated than coroutines. Java’s type system is way less safe... I don’t need to compare kotlin to 7... 8 is bad enough.

 

It's like spoken languages:
Norwegian, Swedish and Danish are so like they can be understood by each other...
English have many country adaptions.
German is strictly
Italian is fast...
Swahili... I don't know any...

 

Yes true. The architecture is what matters but anyways the support for Java has already been dropped by Android so Kotlin is deliberately the only "official" option. Even though I don't have any problems with Java anyways.

 

Java makes me want to slit my throat open and Kotlin not, what can I say 🤷‍♂️

I guess that everyone is entitled to have an opinion at some point.

 

really Good Topic

 

If you're interested in some more info, check out this article by Jake Wharton on Android's Java 8 Support

 

I'm bias because I really didn't how understand programming Android apps till I started to use Kotlin.

 

That's understandable and fine. There is absolutely no fault there.