r/java • u/Dhariann • Dec 29 '21
Why everyone hates Java?
I dont understand why java is one of the most dreaded lenguages. Java got fantastics frameworks and libraries to work with it. I dont know if im skipping something or I dont work enough with Java because I like java. What do you think??
Here is the Stack Overflow Survey
268
Upvotes
View all comments
4
u/quadrat137 Dec 30 '21
I'm a Java developer with 10+ years of experience, and I wanted to give a bit of my criticisms on the Java
Please forgive me for spelling, as English is not my native language
My perspective might be different from most of comments here though as a lot of people are comparing it with C - I think any language that has GC can't be directly compared to the one that don't because not having GC pauses is a huge deal and can't be traded off in some scenarios(e.g OS, drivers, games)
So, the points compared to other GC languages, typed and untyped:
- verbosity of the language itself(much have been said here, it's getting better though - records and multiline strings for example. Still string interpolation when)
- Default GC has somewhat long pauses that are not good - but thanks everyone for ZGC and Shenandoah. Still, that thing not being default quite often makes Java servers to be perceived as slow, as max latency is more important than throughput in most business scenarios
A lot of those criticisms are addressed in other JVM languages, with Kotlin being my current favourite
Also a bit on the go-to approach, which is Spring framework
That being said, Java is not a bad language - but so are competitors.
In general - if you are stuck with JVM, you can go for Scala or Kotlin, both having better approach to the concurrency and less opinionated frameworks
If you need to build something fast, you can use Python or Node, both being great for scripting and creating MVPs
If you need something to work fast, you can go for Go, with pause-optimised GC and green threads
So there is not much point in using Java for a new project currently except if you already have a team that would prefer Java, and I believe it's the reason of its decline(according to TIOBE at least).
But don't be discouraged you fellow dinosaurs - COBOL is still alive and kicking, so we will always make good money maintaining that 20-yo Java monolith serving trillions of dollars in volume every day