r/learnjava • • Nov 25 '20

why do people hate java so much?

why do people hate java? I personally really love java because of the OOP paradigm and it makes my codes cleaner. not to mention the portability. but i swear I see more than one tweet hating on java everyday, or saying java is dying. is java really dying?

I guess I have two questions; why do people hate on java and is there still a future for java?

120 Upvotes

88 comments sorted by

View all comments

1

u/Serializedrequests Nov 26 '20 edited Nov 26 '20

I'm a hater, but I like Java as far as it goes. I love the good things: portability, performance, and maven.

What I don't love:

OOP is not the be all and end all. OO designs can be very complex and hard to understand. I view a lot of classic OO design patterns as Java workarounds rather than clean code, and don't particularly care for DI frameworks as again feeling like a workaround.

Many popular Java libraries bafflingly fail to learn from other successful frameworks. For example, ask me how hard it is to get useful query logging in Spring Boot: I could write a research paper on the topic, and I still haven't figured it out (before everyone tells me the option to enable, what I am saying here is the output of that option SUCKS for debugging compared to every other ORM ever. The queries are unreadable and contain no useful metadata).

Java syntax itself is a bit off for readability. I want to read code top to bottom, and the type definitions constantly break the flow by pushing the behavior off to the right. Newer languages do this better. Likewise, I want to declare locals "final", but this results in tremendous line noise and so is rarely done.

Lack of safety, despite being compiled. "Null" in Java is a giant escape hatch from the type system and must be constantly guarded against. It is a frustrating waste of time and lines of code.

Annotation oriented code. This is what I call JPA or spring boot style code with @ on everything. This is, like null, a giant pointless source of confusing runtime errors and feels like a new passive aggressive style of coding, and overall worse than imperative coding.

Lastly, the general verbosity. I don't mean syntax, I mean the language lacks high level expressiveness so the amount of pointless boilerplate code tends to be off the charts compared to projects I maintain in higher level languages.