DEV Community

Discussion on: 10 reasons to switch from Java to Kotlin right now!

Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard

I've read this insightful comment about what happened when Java adds new features that were in Kotlin only before. New features released in Java is a good thing IMHO, it means the whole ecosystem progresses. But for people to actually use the new features, they have to be willing to update the SDK. But it turnns out Java programmers are very wary of updating the SDK. Java 16 is released but we are still in the middle of the migration from Java 8 to Java 11.

So Kotlin is perhaps doomed in the long term, but in the long term we are all dead!

Collapse
 
190245 profile image
Dave

Who told you that people are wary of updating Java?

I mean, I wouldn't want to use something in Production that didn't have an LTS agreement behind it, but that's not only limited to Java.

The main issue, is the security manager and Modules when moving through Java 9/10... but maintaining legacy projects always has legacy problems. All our newer projects are in Java 11 when deploying, or 14 during development (Maven profiles...). When we hear the next LTS release beyond 11, that will be our default - the next morning (and CI/CD will log tickets for projects that fail to build for some reason).

Challenging, yes, but wary?

Collapse
 
kgunnerud profile image
Kenneth Gunnerud • Edited

I agree if the premise is SDK 8/11 or Kotlin forever, but at least the place I have been (mostly public sector) has seen a shift into product teams with autonomy, so updating to a new SDK has and is not an issue.

Also, if the issue is that companies refuses to upgrade the SDK, can that be applied to Kotlin as well (over time)? Or is every part of a company that uses Kotlin always able to upgrade but those that use Java are not?

I love kotlin as much as the next guy, it's just that every post I see about Kotlin vs Java is about the small stuff (which of cource comparing Java 8 vs Kotlin leaves java with a lot of bruises), but I never see any discussions about the negatives? Cause if I am to suggest to a customer, a client or just my co-workers that we should change, it also has to include the down sides and usually with a timeframe more than a year ahead when picking a language for a product. And if the premise is that people don't upgrade SDK, the same can just as much be applied to Kotlin and then you gain little. Something along the lines of: Fix the culture before you try fix it using technology.

Edit: And I agree, I love that people see Java and think in the lines of: "We can do this better!", such as Kotlin did. And as we see now, the ecosystem and Java is also better off. Java has its weaknesses and luckily some of them are being adressed. This post is rather good if you wish to see how the JVM team is thinking about changes: blogs.oracle.com/javamagazine/java...

Thread Thread
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard • Edited

Updating Kotlin is not the same as updating Java. In the second case you upgrade the virtual machine and hope for the best, which has been sometimes painful in the past, while when you update Kotlin you are still compiling bytecode for the same virtual machine, so you keep the same infrastructure.

And yes Java being a very mature technology has pros over Kotlin, for example the compiler is faster and static analysis tool are better. And hiring Java developers is easier, outside of the Android world, you may have to be OK with developers learning Kotlin on the job.

Thread Thread
 
kgunnerud profile image
Kenneth Gunnerud • Edited

Yes, I agree with those premises. although I wish it came more apparent in the discussions between Java or Kotlin

Thread Thread
 
190245 profile image
Dave

@jmfayard
you upgrade the virtual machine and hope for the best

That sounds painful to even read. Please tell me someone you work with has read, understood, considered and then tested the upgrade path, before just "hoping" it will work...

Collapse
 
vngantk profile image
Vincent Ngan

Kotlin is already like Java 16, and much more, and you do not need to switch your JVM. You can keep using your most comfortable JVM 8 or 11.