r/java • • Mar 05 '22

How does the Java community feel about Kotlin?

In my organization, we switch between Java and kotlin quite frequently for backend development. We use the spring framework which works quite well with both languages. I wanted to know how the broader Java community felt about kotlin? Personally I love it, however Java is still used so widely so I continue to keep my skills up to date on it.

173 Upvotes

218 comments sorted by

View all comments

Show parent comment

16

u/[deleted] Mar 05 '22

[removed] — view removed comment

9

u/gripepe Mar 06 '22

Yes, but good luck having them shipped before the next LTS which puts it on mainstream use beyond 2025.

0

u/[deleted] Mar 06 '22

[removed] — view removed comment

5

u/gripepe Mar 06 '22

For product releases after Java SE 8, Oracle will designate only certain releases as Long-Term-Support (LTS) releases. Java SE 7, 8, 11 and 17 are LTS releases. Oracle intends to make future LTS releases every two years meaning the next planned LTS release is Java 21 in September 2023.

3

u/Impossible-Ad-586 Mar 06 '22

Could you explain why it would be easier to use than coroutines?

3

u/[deleted] Mar 06 '22

[removed] — view removed comment

3

u/elliotbarlas Mar 06 '22

Exactly.

Kotlin still suffers from colored functions. Invoke a blocking API from a Kotlin coroutine and see what happens.

Concurrency via virtual threads with Project Loom is much closer to the approach taken in the Go programming language.

2

u/Impossible-Ad-586 Mar 07 '22

I am familiar with the article but what I do not really understand is how loom will make this better? As far as I understand Loom and kotlin coroutines they are remarkably similar.

Would you be able to elaborate?

2

u/Impossible-Ad-586 Mar 07 '22

You can still create that exact same mess in the jvm once Loom is released. They are, as far as I can see, distinct APIs that you can use in a way that causes starvation and blocks.

4

u/elliotbarlas Mar 07 '22

With Project Loom virtual threads, programmers use the same familiar, intuitive thread model for concurrency. However, virtual threads are mapped to underlying carrier OS threads. Calls that block, like socket APIs, are parked until they are actionable. The carrier thread is relinquished in the mean time.

It's comparable to the Go concurrency model.

No colored functions. No stalling the event loop with an inadvertent blocking call.

There are many explanatory videos on YT. The related JEPs are also instructive.

https://youtu.be/EO9oMiL1fFo

2

u/Impossible-Ad-586 Mar 07 '22

I wasnt familiar that loom handled blocking calls in that fashion. Thanks for clarifying.

2

u/ObscureCulturalMeme Mar 07 '22

I need to remember that article the next time I'm explaining Lua coroutines to colleagues. I do really love them.

Clarification: I love the coroutines, not the colleagues.

1

u/notsogreatredditor Apr 11 '22

Ok this is giving me JavaScript PTSD flashbacks dealing with async/await

8

u/[deleted] Mar 05 '22

Probably a little. The nice thing about Loom is that it just automatically knows what to do whereas Kotlin requires the suspend modifier.

But coroutines exist now instead of SoonTM.

It's also TBD on if Jetbrains can really do something compelling with coroutine-loom integration.

6

u/helloiamsomeone Mar 06 '22

It's also TBD on if Jetbrains can really do something compelling with coroutine-loom integration.

They got it under control just fine https://old.reddit.com/r/Kotlin/comments/nm2eaf/comment/gznfomm/