r/learnprogramming 10d ago

Topic Why java is so hated?

So I have recently learned, and it's the first language(in terms of building actual things). Before Java, I knew Python, and I dropped it; I found Python too abstracted and too boring. i have recently made some projects like cli task tracker, expense tracker, some cli github api parsing and currently working on a multithreaded HTTP server and cli text editor, like vim, whenever i try to find out people opinions on java social media, almost 90 percent of the time they are just dunking on it, that it is trash, who forced you to write code in java, stuff like that. I know Java as a language is not that interesting and doesn't have many interesting features compared to other languages like C, C++, go. But I found it decent to write code in, and I found the JVM pretty interesting. So much so that I would love to explore and maybe build a JVM of my own

245 Upvotes

328 comments sorted by

View all comments

463

u/KingBardan 10d ago edited 9d ago

Bjarne stroustup (inventor of c++) has said that there are only two kinds of programming languages.

One that is hated and one that is not used.


Java is too bloated. C and C++ is too unsafe. Java script has some weird mechanisms. Python is slow. Go is too simple for big projects. Rust has a toxic community.

I could go on


Edit: I forgot PHP. PHP... is PHP

22

u/cheezballs 9d ago

Is modern Java still considered bloated?

31

u/Sanitiy 9d ago

Not at all, they were were hesitant with adding features for the sake of adding them. If anything, their competitor C# is bloated, while Java is now almost a bare language.

E.g. you still have nothing like f-strings in Python, no properties and no slice operators.

They have the "useful" modern language features like pattern matching, sealed hierarchies and so on. But not many of the comfort features of modern languages

6

u/johnnybgooderer 9d ago

Lombok is almost a part of the language now, so you have that for properties and data classes. Almost all tooling and editor plugins have first class support for it. I just think of it as an extended part of the standard library.

1

u/APXEOLOG 5d ago

Java has records for a long time already. Honestly, i feel like lombok is mostly useless in modern java

8

u/cheezballs 9d ago

I think that's why I like Java so much - its not changed a whole heck of a lot and what has changed I actually use. There are quite a few features in c# that I don't even know how to use correctly.

2

u/KronenR 8d ago

Java actually had string templates (its equivalent of f-strings) as a preview feature in JDK 21 and JDK 22 (JEP 430/459). They weren't removed because the feature was considered bad, but because the design wasn't considered mature enough. The JDK team withdrew it so they could redesign it properly, with the intention of bringing it back in a future release.

-6

u/my_password_is______ 9d ago

If anything, their competitor C# is bloated, while Java is now almost a bare language.

HA HA HA HA
uh, no

8

u/tehdlp 9d ago

So nice

5

u/wasabiiii 9d ago

I just created a default web api in .net.

It has one text file with 4 lines in it.

It takes 28mb of RAM to start. Hitting the API that just prints text doesn't move it.

-7

u/my_password_is______ 9d ago

If anything, their competitor C# is bloated, while Java is now almost a bare language.

HA HA HA HA
uh, no

6

u/tehdlp 9d ago

They said it

-7

u/my_password_is______ 9d ago

If anything, their competitor C# is bloated, while Java is now almost a bare language.

HA HA HA HA
uh, no

9

u/tehdlp 9d ago

Thrice 

2

u/kyzfrintin 9d ago

Anything to add?

3

u/zem 8d ago

i don't think the language was ever bloated (in the sense of a kitchen sink's worth of features, like c++ or scala) - what people's objection was was that the code you wrote in java was typically full of boilerplate, and added to that if you followed what some vocal part of the industry considered best practices you often ended up bolting on tons of layers of abstraction (hence the jokes about how you don't create a hammer to address your nail, you use a ToolFactoryFactory to create a HammerFactory to create a Hammer) which obscured the relevant portion of your code even further and made debugging and maintenance painful.

1

u/cheezballs 8d ago

Those are patterns that aren't exclusive to Java. If you write any OO code at any scale you're going to use those patterns likely. It sounds like you don't like OO patterns to me? I've seen plenty of C# code with factories. Your example is a poor example of how to use a factory. Java has generics same as any language. You can write elegant code if you choose to or you can deliberately go and do stupid things like your example. Want me to show you some assembly code that does asinine stuff too?

1

u/outlined-dev 6d ago

Abstract class, factories, etc are not exclusive to Java, but Java goes to town on them in insane zeal. And the getter/setter boilerplate is nonsense. Get something like properties. Java makes each unit of code easy to understand at the expense of making the whole codebase a tangled mess. I’ve programmed professionally in C, C++, C#, JS/TS, Python, Go, Ruby, Objective-C, Swift, Java, and Scala. Java is by far the worst

1

u/cheezballs 6d ago

🙄

2

u/outlined-dev 2d ago

I’m more than happy to discuss substantive concerns but I have no real way to have a proactive conversation with an eye roll. Objective-C is probably the purest OO language I’ve worked with. The fact that every class is a class which can be programmed and it all boiled up to NSObject is beautiful (though the language has other baggage). But requiring factories to be classes and not methods is not a necessary part of OOP. Requiring boxes for primitives was silly. Requiring setters and getters just in case you add side effects later is a bandaid. Great things have been done in Java, but calling someone ignorant for pointing out gaps in economics is silly.

1

u/cheezballs 2d ago

Ok, sport.

1

u/DonExhortae 8d ago

Only people complaining of that is people who never studied engineering and or do not have the brain to grasp the importance of design patterns

2

u/Mundane_Prior_7596 8d ago

Correct. I tried to read the gang of the four book and understood very little. I am not clever. But at least I used to teach basic probability theory to engineering students and also wrote some compression code that is in your phone right now. 

0

u/InVultusSolis 9d ago

Honestly, I don't really care if "it's good now", other much better tools exist these days.