DEV Community

Discussion on: Is Rust going to Replace Java?

Collapse
 
guptashreyansh profile image
Shreyansh Gupta • Edited

I don't know about rust but I think kotlin is better in terms of development experience and most of the time kotlin code is concise and shorter than java code.

Collapse
 
siy profile image
Sergiy Yevtushenko

Conciseness per se is pointless. Development productivity is only thing that matter when comparing Kotlin and Java. And Kotlin often is worse than Java in this regard. At least for backend development.

Collapse
 
mate3241 profile image
mate3241

Do you have personal experience with this? I wonder if this will change with time as people adapt to using the language more. In my area, Kotlin jobs or even projects are still very rare unfortunately, so please elaborate.

Thread Thread
 
siy profile image
Sergiy Yevtushenko

This might change over the time, but odds are low since some issues are inherent to Kotlin as a language. Here is my answer on similar question with more details and my personal experience.
I should note, that many Java issues, which make people consider Kotlin, can be solved by adopting Pragmatic Functional Java in combination with Java 11 and up (especially Java 17).

Collapse
 
mate3241 profile image
mate3241 • Edited

Yes, but Kotlin was designed with this exact mentality. Java plus some features, minus some annoyances, basically.
While I assume that you can do most things in Rust, it is primarily a speed and memory safety focused language. Without garbage collection, I might add. That does not make Rust bad, obviously, but I genuinely don't see the point of this article.

Collapse
 
gklijs profile image
Gerard Klijs

And adding some other annoyances, like not being able to use Java 17 together with Kotlin at the moment.

Thread Thread
 
therickedge profile image
Rithik Samanthula

Right.

Thread Thread
 
mate3241 profile image
mate3241

I was actually wondering about that. Is Kotlin supposed to be compatible with Java in the future as well? If not, major RIP.

Thread Thread
 
therickedge profile image
Rithik Samanthula

True.

Thread Thread
 
gklijs profile image
Gerard Klijs

Yes, and likely it's won't be much longer before Java 17 is supported. Spring is likely to take a year before going to 17. If it's not possible by then, it's going to be a major deal breaker. Originally people used Kotlin mostly because they were stuck on also JVM's with Android. Kotlin also has other compile targets, like native and js. But I think they are still used very little.

Thread Thread
 
therickedge profile image
Rithik Samanthula

Despite all the differences between the two languages, Java and Kotlin are 100% interoperable. You can call Kotlin code from Java, and you can call Java code from Kotlin.

Thread Thread
 
gklijs profile image
Gerard Klijs

Not 100%, you can't call a coroutine from Java, and you can't use Java Code that contains records for the moment. But yes, it all runs on the JVM, as does Scala, Groovy and Clojure, which you could use all together in one app.

Thread Thread
 
gklijs profile image
Gerard Klijs

Seems you can use Java records with Kotlin (and even define them in Kotlin)
kotlinlang.org/docs/jvm-records.ht...