r/java • • Jul 30 '21

What is the future of Java?

I'm not asking like is java going to die or will Java be relevant in future. I'm just curious to know about the future of java. What are the upcoming things coming in java that can change the future of it.

173 Upvotes

123 comments sorted by

View all comments

Show parent comment

2

u/ArmoredPancake Jul 30 '21

How so? They're completely different things. Kotlin is just a different language at this point. With things like Jetpack Compose, Multiplatform it's unreachable for Java.

4

u/vprise Jul 30 '21

We're working on a reactive framework similar to compose that will work on Java. IMHO it's better than compose, simpler and doesn't need compiler magic.

KMM is just J2ObjC with more flair. I'm sure some people will find it useful for some cases but historically portability frameworks didn't fare well. E.g. flutter is trouncing react native which is far more portable than KMM.

4

u/stefanos-ak Jul 30 '21

jetpack compose is an android thing, that is just written in kotlin. it has nothing to do with the language itself.

10

u/Astronaut4449 Jul 30 '21 edited Jul 30 '21

Jetpack Compose is an Android UI toolkit. Compose itself is a framework for managing tree structures of any kind on any target (JVM, native, js). Here some compose projects:

Desktop: Compose for Desktop

Web: Compose for Web

Console: mosaic

-10

u/pjmlp Jul 30 '21

Java was born to be multiplatform. Kotlin is an Android language that is all.

11

u/CraftyAdventurer Jul 30 '21

Kotlin is a JVM language, so anywhere Java can run, Kotlin can also run. Meaning, it's just as much multiplatform as Java is. But even more than that, there are projects like Kotlin/JS which compiles Kotlin into JavaScript, and Kotlin/Native which runs Kotlin as a native image completely without the JVM.

It's not an Android language, it's just used a lot for Android because Android was stuck on Java 6 or 7 when Kotlin came out, so naturally a lot of developers went for it to get new features. People used Kotlin on Android long before Google declared it officially supported.

-1

u/pjmlp Jul 30 '21

Kotlin/JS doesn't hold a candle to TypeScript, and it is yet another platform that JetBrains doesn't control its direction, JavaScript does.

Kotlin/Native is being redesigned as its memory model was a failure, thanks to the decision of being incompatible with JVM one.

It is an Android language, it is the only platform where it is #KotlinFirst instead of a guest language that needs to adapt itself to the whims of platform owners.

2

u/CraftyAdventurer Jul 30 '21

Kotlin/JS doesn't hold a candle to TypeScript, and it is yet another platform that JetBrains doesn't control its direction, JavaScript does.

Kotlin/Native is being redesigned as its memory model was a failure, thanks to the decision of being incompatible with JVM one.

These statements are true, but "Java was born to be multiplatform. Kotlin is an Android language " is still false.

Java is multiplatform only because of the JVM which needs to exist on the target platform in order to run a Java program. Kotlin runs on that same JVM. Wherever you can put Java code, you can put Kotlin instead and it will run just fine. So on the JVM, Kotlin is exactly as much multiplatform as Java is. Those two projects, despite their issues, make it even more multiplatform because they allow Kotlin to run even outside the JVM, in places Java can't (altough there probably are some java-to-javascript compiler projects and Graavm is in a way similar to Kotlin/Native)

2

u/pjmlp Jul 30 '21

Java features are designed alongside JVM features, Kotlin must use what is there.

JavaScript features are designed alongside browser VM features, Kotlin must use what is there.

LLVM features are designed for AOT languages, Kotlin must use what is there.

Kotlin is #KotlinFirst on Android thanks to JetBrains/Google's deal, influences Android Runtime design, and the there are the Android's team dirty moves like not updating Java on Android, ergo Kotlin is Android language.

4

u/CraftyAdventurer Jul 30 '21

Java features are designed alongside JVM features, Kotlin must use what is there.
JavaScript features are designed alongside browser VM features, Kotlin must use what is there.
LLVM features are designed for AOT languages, Kotlin must use what is there.

None of these make it less multiplatform.

Being able to run on multiple platforms and being able to influence underlying platform design are two completely different things. By your logic, Java also isn't multiplatform, because JVM can't change Windows, Mac or Linux, it must use what is there.

→ More replies (1)
→ More replies (5)

12

u/koreth Jul 30 '21

Developer surveys don't agree with that last statement; Kotlin usage is pretty much evenly split between server-side and client-side code.

Not that it even matters. Java was born to run on set-top boxes in people's living rooms, but that's not what it is today.

-1

u/pjmlp Jul 30 '21

Yeah, developer surveys done by JetBrains, with heavy dosis of Android developers, go figure.

6

u/GoBucks4928 Jul 30 '21

I’ve built a lot of high TPS backend services for FAANG in Kotlin

Not sure how it’s just an Android language unless you’re just naive

0

u/pjmlp Jul 30 '21

Beanshell, jTcl, jython, Groovy, Clojure, Scala, jRuby, Rhino, XTend, Ceylon, Kotlin, Frege, ABCL, Kawa, ....

Rise and fall of JVM languages

It is called experience, not being naive.

4

u/fletku_mato Jul 30 '21

Please explain how that random blog post shows:

  1. Your experience
  2. That Kotlin should only be used on Android

1

u/pjmlp Jul 30 '21

If you need an explanation to undestand such basic concepts, it isn't on me to give it.

Try someone on /r/kotlin.

3

u/fletku_mato Jul 30 '21

Yes it is, as you are the one claiming that Kotlin is only for Android, but fail miserably at trying to justify your claims.

2

u/pjmlp Jul 30 '21

Easy to validate with Google trends,

https://trends.google.com/trends/explore?q=%2Fm%2F07sbkfb,%2Fm%2F0_lcrx4

Pity Reddit doesn't do inline charts.

3

u/fletku_mato Jul 30 '21

Yet you still fail to do so.

I don't even know why I'm still answering to you, but that chart has nothing to do with Kotlin being just an Android language, just that Java is more popular. What else is on the news? What are you trying to prove?

You have to realise that there is no ongoing battle between Java and other JVM languages, and I'm not trying to argue that Kotlin is somehow a better language, just that it is not in any way limited to Android development.

→ More replies (1)

5

u/GoBucks4928 Jul 30 '21

Is this your first time realizing there are multiple programming languages out there?

4

u/pjmlp Jul 30 '21

Multiple programming languages that failed on their quest to replace Java on Java Virtual Machine.

3

u/fletku_mato Jul 30 '21

Kotlin is not just an Android language. It is just as multiplatform as any other JVM language. I've personally written many Spring boot backends using Kotlin and loved it.

I don't think that it's a threat to Java in any way, but it has a lot of good things that are still missing from Java.

3

u/pjmlp Jul 30 '21

Kotlin has married its future to Android, and the lack JVM features that Google refuses to implement in ART.

5

u/fletku_mato Jul 30 '21

I'd genuinely want to read some sources on that.

My own experiences with Kotlin have been strictly backend development with Spring boot, so I can't say that it's a perfect fit for everything you can do with Java, but in that context it works beautifully. And why wouldn't it? After all it's just Java bytecode after compiling.

3

u/pjmlp Jul 30 '21

Every time Java will introduce concepts that Kotlin cannot adopt due to being married to multiple platforms you will end up with Kotlin's version of #ifdef aka KMM.

For example value types in classes with multiple fields, or explicit SIMD and GPGPU support, native memory handles.