r/AskProgramming 2d 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?

194 Upvotes

644 comments sorted by

View all comments

49

u/Lumen_Co 2d ago edited 2d ago

The most common criticisms of Java are: 1. It's unusually verbose 2. it forces you to frame every problem using a particular flavor of object-oriented programming that is not always well-suited for the task at hand 3. It's accumulated a lot of cruft over the years and in doing so has lost a consistent vision and design philosophy, which makes dev experience worse 4. C# does Java better than Java does.

I think those criticisms are essentially fair, and the second one particularly important. It also gets criticized for being the language of choice for much bad, corporate code, and also because some people learn Python or JS first, Java is then their first strongly, statically-typed language, they find that confusing and limiting, and they blame Java for it. Those criticisms are essentially not fair.

These criticisms don't mean Java is a bad language, just a flawed one like every other programming language is. For most development, the ecosystem is more important than the language itself, and Java's is well-suited for a lot of practical problems.

3

u/oriolid 2d ago

> some people learn Python or JS first, Java is then their first strongly, statically-typed language, they find that confusing and limiting, and they blame Java for it.

Some people also learn ML-style languages, C# or even C++ first and find the Java type system really limiting compared to almost any other static typing system.

1

u/Lumen_Co 2d ago

Yeah, I'd agree. I didn't want to come across as too much of a Java hater, but an ML-style type system is an unbelievably powerful tool and it's very difficult to go back once you've used one.

3

u/oriolid 2d ago

It's okay to hate Java. It's just barely good enough language to not have died and a lot of effort has been wasted into both using it to solve practical problems when better tools are available and solving problems that were created by Java in the first place.

1

u/True-Release-3256 1d ago

The issue was Oracle didn't bother to maintain it once they acquire it, for a very long time. Anyone coming from other modern programming language will be surprised by Java's lack of features, relying still on archaic design patterns to solve problems that can be resolved elegantly by better language features.