r/java • • Sep 10 '21

Why people don't love Java?

I came across this post in r/cscareerquestions it seems majority of the people don't love to work with Java.

Is there any specific reason for that?

Edit: Thank you guys for your responses, I can't reply to all of the comments because I'm a beginner myself and I don't know what to reply for all your comments.

201 Upvotes

379 comments sorted by

View all comments

542

u/thomascgalvin Sep 10 '21

The people posting to that sub are typically young, and probably have more experience with Javascript than anything else.

Compared to JS, Java can feel heavy and constricting. Lots of boilerplate, a type system that's strictly enforced by the compiler, and so on.

It isn't until you have some real-world experience, with code spread out across dozens or hundreds of files, that you realize the "limitations" of Java are actually meant to prevent you from blowing your own foot off.

0

u/[deleted] Sep 10 '21

[deleted]

37

u/Clitaurius Sep 10 '21

Not OP but my opinion is that Kotlin will pass. It was a good driver in getting Oracle to move Java to a faster release cycle and to incorporate some popular language features. A bank can write it's banking software in Java 20 years ago and 20 years from now. They aren't going to take that gamble on Kotlin.

24

u/pron98 Sep 10 '21

It was a good driver in getting Oracle to move Java to a faster release cycle and to incorporate some popular language features.

You are confusing cause and effect. Kotlin was created in 2010, exactly at the time of Oracle's acquisition of Sun, and after years of decline in Sun's investment in Java and weakness in influencing it. In other words, Kotlin was created as a result of Java's stagnation. Following the acquisition, and some adjustment time, Oracle gradually increased investment in Java back to former levels, and that allowed the team to return to the planned evolution pace.

0

u/[deleted] Sep 10 '21

[deleted]

7

u/pron98 Sep 10 '21 edited Sep 10 '21

What had that effect was the acquisition of Sun by Oracle. The cause of lack of innovation and the cause for Kotlin's existence was the same -- the decline in investment in Sun's dying years. Constant innovation was always the goal, and it happened when Java had the resources. It only declined because the money dried out.

As to particular features, while the size of the language doesn't matter -- ML has been the biggest influence on Java innovation -- and we've certainly taken ideas from Scala (the use of sealed hierarchies to represent sum types), we haven't yet from Kotlin, but maybe we will someday (nullability types?). But if any languages light the competitive fire under Java, it's the bigger ones -- Python, JS, maybe C# -- the ones that are actually competitive, not languages with 20-25x smaller market than Java's, and certainly not those that are built on the Java platform (Oracle sells support for the platform, not the language).

3

u/papercrane Sep 10 '21 edited Sep 10 '21

we haven't yet from Kotlin, but maybe we will someday (nullability types?).

I would be the happiest developer in the world if Java had some concise way for me to express in the type system that something was never null.

1

u/tadfisher Sep 10 '21

This is why Java (the language) is intractable for me, as I don't want types to be null by default. I shouldn't have to wrap types or use special syntax to achieve this.

Optional, ironically, makes this even worse. Within a codebase, I can assume non-null optionals, but across library/module boundaries, the language makes no guarantees (beyond the suggestion to avoid null Optionals in the Javadoc), so you end up with two checks to see if a value is present if you want to cover all possible states.

That null-by-default was allowed to persist through JDK 11 basically sealed this wart in the language forever, as I can't see a way to change such a fundamental aspect while maintaining binary compatibility with the JVM ecosystem.

→ More replies (6)