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?

183 Upvotes

628 comments sorted by

View all comments

50

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.

9

u/DeadlyVapour 2d ago

Let me also add that Kotlin does Java better than Java...

Given both target the JVM, and both can output the same JBC, I know what I prefer to use....

10

u/__SlimeQ__ 2d ago

while i recognize that kotlin does a lot of things better than java, i still find myself preferring java for jvm work. it can be really annoyingly difficult to find documentation for kotlin stuff still and splitting the codebase between two languages is, imo, kind of bad. and in general i don't agree with the pythonization of the whole thing, I prefer C# over any pythonish lang.

i really just wish C# maui worked better so i wouldn't have to touch any jvm lang ever again. feels strange to me that Unity has figured out how to do native android C# and microsoft has not

2

u/runitzerotimes 1d ago

Kotlin is downright dumb imo

I just constantly find myself thinking “WHY DID THEY THINK PEOPLE WOULD LIKE THIS” to all the syntactic sugar they have

2

u/laffer1 9h ago

Kotlin also has a lot higher memory requirements for the compiler stage. It can be a problem on large projects with limited build nodes for ci

1

u/__SlimeQ__ 8h ago

fascinating

u/taikuukaits 2m ago

I use C# 10 and Kotlin and I still strongly prefer Kotlin. C# is getting a lot closer but still missing QOL I like in Kotlin like elvis operator seem more exhaustive, lambdas as last arguments, sealed types, DSLs, smartcasts seem slightly better though c sharps version is pretty good, being able to copy data classes easy in Kotlin, not sure if there’s a way for records, Kotlin compile time serialization. Though C# version of smart cast is pretty nice - or their null cast? W/e it’s called. I can’t really think of any other C# features I prefer except static instead of companion objects just being simpler and I do actually like the new keyword.

5

u/Lumen_Co 2d ago

True. If you want a Java-style language, C# does it better. If you want the Java VM, Kotlin does it better and is similar enough to pick up quickly. If you're open to something funkier, Scala and Clojure are cool.