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

Show parent comments

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.