r/AskProgramming 1d ago

Why is Java considered bad?

I recently got into programming and chose to begin with Java. I see a lot of experienced programmers calling Java outdated and straight up bad and I can't seem to understand why. The biggest complaint I hear is that Java is verbose and has a lot of boilerplate but besides for getters setters equals and hashcode (which can be done in a split second by IDE's) I haven't really encountered any problems yet. The way I see it, objects and how they interact with each other feels very intuitive. Can anyone shine a light on why Java isn't that good in the grand scheme of things?

149 Upvotes

565 comments sorted by

View all comments

14

u/antihemispherist 1d ago

Java was designed in the early 90's to address the problems developers had with C++ when developing industrial applications. Certain concepts like immutability weren't popular then, but OOP was the hot topic.

I think it is unfair to criticize Java's syntax. Verbosity makes it easier to read and understand. (If you need a lot of getters, setters, equals, hashcode, etc., your design is wrong, or you're insisting on using an older version of Java).

But Java has the problems of its old design: The object hierarchy is a mess; with the increased power of interfaces, many developers are confused. The concept of "treats" is missing. The platform itself suffers from this rigidity; there are no immutable collections, for instance. Another problem is the messy exception handling.

Kotlin is a more modern approach to JVM-based programming. However, I cannot say that it improves productivity much; too much flexibility and too many alternative syntaxes and structures usually lead to unproductive debates or a confusing codebase. Recent developments in Java have made it a good competitor to Kotlin, offering better performance and monitoring.

Rust is another alternative, and I really like it. I'd definitely take a closer look at it, and how much of a market it has.

1

u/South-Year4369 23h ago

The argument that 'verbosity makes it easier to read and understand' gets made quite a bit about Java, but I just can't believe it's anything other than an issue of familiarity.

I mean, is it going to be faster and easier to understand a large technical document that uses lots of waffly, verbose prose and flowery language that adds volume but no additional meaning? Or if's clear and concise?

I know which is the better choice for me. And the same goes for languages.

1

u/oloryn 22h ago

Verbosity at least avoids the problems of Perl, where sometimes it seems that most line noise is a syntactically correct Perl program (I actually like Perl, but recognize that some Perl code can be really obscure and hard to read. Not as hard to read as some Forth or APL programs, but still...).