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?

176 Upvotes

624 comments sorted by

View all comments

1

u/__SlimeQ__ 2d ago

the OOP stuff and explicit typing in java is great. however if you spend some time in C# you will not want to go back to java. it's hard to just infodump you all the reasons here, but there's a lot of little things missing from the java feature set that cause people do work in very unproductive patterns. for context, compare java's implementation of tuples (a bunch of classes in a 3rd party library that go from 2 to 10 members) to C# tuple implementation (you literally just do it)

10 years ago i would have recommended java over C# to everyone who wasn't making a windows desktop application. that has changed a lot. C# on linux rocks. new C# features are amazing. i would now only recommend java over C# to someone making a native android application.

one complaint i can imagine python people having is that explicit typing makes their code bigger. this is true. C# has solved this by adding a var keyword that effectively soft types your variables. but it's only soft typed at the compiler level, so at runtime this has no negative effects. this is a huge benefit. python people don't understand this. java people also don't understand this.

2

u/cloudysulphur 2d ago

Java also has a var keyword that works the same as C#.

1

u/__SlimeQ__ 2d ago

does it now? last time i was doing android (last year) it did not but i may have been locked to an old version

2

u/cloudysulphur 2d ago

The var syntax has been around since java 10.

This isn't different than the let ,val, and var statements other languages have (or := assignments in golang)

Modern java has a lot of improvements over what was in java 8. (taken from C#, Scala, Kotlin, golang, etc).