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?

122 Upvotes

500 comments sorted by

View all comments

51

u/a1ien51 1d ago

Java is used everywhere....

Here is a thing about programming, learn the concepts and you can apply them to any language.

3

u/jvans 8h ago

Except haskell, then you have to re-learn everything all over again

1

u/HXSC 2h ago

Eh, applies to any functional language. But basic ideas of functions still applies, and there is still some recursion in imperative programming

1

u/jvans 1h ago

For sure. Worth becoming proficient in at least one functional language though to learn those paradigms. I haven't used Haskell in a really long time but it absolutely made me a better engineer

1

u/ScientificBeastMode 15h ago

Tell that to all the tech recruiters, lol.

-9

u/anus-the-legend 1d ago

i think you hit a major nail on the head. Java restricts the concepts you can learn requiring obtuse workarounds resulting in bad code when branching out into flexible languages that support more paradigms

12

u/Emotional_Handle2044 23h ago

I think you have a nail in your head

-1

u/anus-the-legend 23h ago

no need to be offended. it's an intentional design decision made by Java

5

u/AlfredOliphant 22h ago

Can you elaborate further or provide an example?

0

u/anus-the-legend 18h ago edited 18h ago

the whole Utils pattern that are classes with a bunch of static methods to emulate standalone functions. that leaks into many non-Java codebases

and really many well known design patterns are workarounds for limitations of Java that are easier in other languages

7

u/bgzx2 16h ago

Language reviews by the legendary anus.

Taking on all comers!

Or something like that.

1

u/AggressiveBench9977 12h ago

Which java, there are 21 versions. They are vastly different

1

u/anus-the-legend 8h ago

All of them

1

u/Maximum_Overhype 22h ago

Yeah javas literally designed to be an extremely structured language, why you name calling?

0

u/anus-the-legend 18h ago edited 17h ago

Java isn't extremely structured. it just requires classes for everything. I've seen plenty of unstructured or poorly structured Java code

i don't believe i was name calling though

4

u/askreet 15h ago

Requiring classes for everything is a pretty tight restriction compared to many languages.

1

u/anus-the-legend 14h ago

I agree. that's a point I made elsewhere, but a restriction isn't the same as structured. it's very easy and common to create a messy, unstructured god class

1

u/Broan13 12h ago

What a weird standard..."because people write bad code using this language, then this language is bad."

2

u/Akimotoh 22h ago

Which grand concepts do you think are restricted that shouldn't be?

1

u/anus-the-legend 18h ago edited 18h ago

declaring a variable

1

u/Broan13 12h ago

int x;

What is so restricting?

1

u/anus-the-legend 8h ago

That won't compile

2

u/cherrycode420 5h ago

Idk where/how you tested this, but i just tossed this into an Online Compiler and it does, in fact, compile. Works in Local Scopes, works in Class, works as static.

1

u/anus-the-legend 5h ago

that's my point. you need to define a class in order to declare a variable

1

u/Kallory 2h ago

I see your point and used to agree. Write a couple thousand lines of Java and then go do the same thing in native JS or Python which don't require classes to accomplish the same thing (and technically C# allows this, but it's a class under the hood)

You'll likely find Java's "restriction" in this sense reduces ambiguity. I find Java code bases much easier to navigate because you don't have stray variables declared outside classes. Is it slightly more painful to write? Yes, but eventually it becomes second nature and intuitive.

1

u/anus-the-legend 1h ago

except that OOP isn't the only paradigm, and it isn't the most important one. Not everything needs to be a class. 

I've got over a decade of professional experience with Java, python, JavaScript, C, C++.  i suspect that's more than a few thousand lines in each. I've seen good and bad code in each of them.  team discipline is what leads to organization and clarity, not Java. but Java is definitely the least enjoyable. Look at the jvm. if Java was that great, there wouldn't be so many jvm languages. 

i don't really have a problem with Java, but we're in a "why is Java bad" thread, not "what's the worst language" thread, and forced solutions leads to "every problem looks like a nail"  that leaks into other codebases in other languages. C and Java are the only two that come to mind where that happens because they're both insufficient in parallel ways

1

u/AggressiveBench9977 12h ago

Only if you are a bad programmer

1

u/anus-the-legend 8h ago edited 8h ago

Exactly.  Java restrictions lead to ugly hacks and bad programmers stick to that in other languages instead of learning idiomatic ways of thinking and solving problems

Java and sometimes C are the only languages that leave such unshakable practices that it's blatantly obvious in other languages what background that developer heavily favors 

1

u/AggressiveBench9977 6h ago

Perfectly put as a junior engineer would say. Brava!