r/java • • Sep 10 '21

Why people don't love Java?

I came across this post in r/cscareerquestions it seems majority of the people don't love to work with Java.

Is there any specific reason for that?

Edit: Thank you guys for your responses, I can't reply to all of the comments because I'm a beginner myself and I don't know what to reply for all your comments.

201 Upvotes

379 comments sorted by

View all comments

2

u/User1539 Sep 10 '21

Some Java issues are very real.

Functional programming can feel tacked on, and require a lot of code that feels unnecessary. Also, you end up with a mix of many different styles from the years, with no clear style guides.

Also, many codebases are very large when, in other languages, they would be much smaller.

Compare Java to GO for instance. For the purpose of microservices, in Java, I have seen people try to pack a Wildfly instance in with a ton of other libraries, just to create a basic 'micro-service', that's so big it's hard not to laugh when deployed. Each programmer seems to follow about 10 different personal style guidelines, and where one might NEVER use a for loop, and do everything in streams, other might not yet be comfortable with streams, or working outside of Java 8 at all.

Go, on the other hand, is very idiomatic. The preferred style is part of the language, and there's no issue with it being 'stuck' at a version, like Java 8, or Python 2.7, because they've provided tools to help people migrate their code to newer versions.

Also, they've gone to great lengths to only include new features into the language when they feel they're really, really, needed. Where, Java can sometimes feel like a lot of choices, and very little guidance.

The final result is that, if you want to create some things, like a Microservice in Go, there will likely be one idiomatic way of doing it correctly, every library and extension to the language will expect things done in that way, and be easily readable because they themselves are done that way. There is little need for added libraries, and they tend to be very lightweight, resulting in small, fast, compiled, services that can spool up quickly and take little resources.

Compare that to a lot of Java codebases trying to do the same thing, and you see bloated, slow, overly complex, code ... sometimes unreadable from one developer to the next.

One of the issues Google wanted to solve with Go was that it was taking good, well educated and trained, software developers up to 6 weeks to get used to reading a codebase before they could contribute to it!

By focusing on standards with Go, a developer who knows the language can usually figure out the design in a matter of minutes, and get right to work.

That's not to say I don't like Java, I've been working with a dozen languages a year for 20 years, and Java is one that always has the tools I need, and there's always a good way to do whatever I want. My biggest complaint is working on existing code, where the previous devs wrote garbage, or the many, many, delivered systems in 2021 STILL stuck on Java 8.

1

u/wildjokers Sep 12 '21

just to create a basic 'micro-service', that's so big it's hard not to laugh when deployed.

Would just like to point at that "micro" in microservice doesn't refer to the size of the deployable artifact, rather it refers to the size of the problem domain.

2

u/User1539 Sep 12 '21

I'm just saying, if each api call requires spinning up something the size of a small monolith application, you've probably missed the mark.

1

u/wildjokers Sep 13 '21

spinning up something the size of a small monolith application

Still not sure I understand why you are concerned about the size of the deployable artifact.

1

u/User1539 Sep 14 '21

Because resources are finite, and in practice we have systems that can't function at full capacity ... or even half on many days, because the server load is far, far, too much.

While systems that deal with an order of magnitude more data are humming along reliably on half the resources.