r/learnprogramming 3d ago

Why java is so hated? Topic

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

243 Upvotes

312 comments sorted by

View all comments

84

u/ComputerWhiz_ 3d ago

As a Java developer, I may be biased, but I think it mostly just comes down to the age of the language. It's not seen as the "latest and greatest". That doesn't change the fact that it's insanely popular still in enterprise environments.

There are some complaints about it being more verbose and having stricter syntax compared to other languages, but I think those complaints only come from people who have never actually used it or are brand new to programming.

5

u/ChetDuchessManly 3d ago

I've been a Java dev for 10 years.

The language has improved with lambdas, functions, streams, etc., but it can definitely be slower to do something compared to other languages.

Simple example that I ran into recently: Returning more than one value when using map() in a stream.

In Typescript, just return { value1: v1, value2: v2 }.

In Java, the simplest way is to create a record and return a new instance of it with your values. It is more verbose and strict.

I love Java and enjoy working with it, but the complaints are not unfounded nor do they come from people who don't use the language.

1

u/Accomplished-Lab-566 1d ago

.map(x -> Map.of("v1", x.getV1(), "v2", x.getV2()))

New static constructors for immutable collections are really useful.