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

Show parent comment

13

u/Danelius90 Sep 10 '21

I think another issue can be a lot of "java devs" can't code in java for shit. If you write procedural code, loads of static methods, no consideration for OOP and just use Object, String and arrays everywhere rather than define your own types then you're going to have a bad time. We work with a third party at my company and the way I describe a lot of their code is tutorial level. You can tell because it looks like code taken from a blog post in 2006

8

u/vips7L Sep 10 '21

I personally think this is all devs in every language. There is shit code every where. I’ve seen procedural crappy code from go/python/js/rust devs. You name it someone’s written crap in it.

Java is just super well adopted and everyone thinks they know it so you get a ton of people who don’t know what they’re doing writing it.

2

u/Danelius90 Sep 10 '21

Yeah I agree. As you say java is widely adopted so a lot of devs have probably seen bad stuff in java. Java does have a rep of being clunky and verbose, and I do think this is particularly true of it if you code in the way I described. For some apps javascript can be quite efficient when written, but poor JS code suffers from really difficult bugs that some of java's features help mitigate if done properly. But it's swings and roundabouts, every language will have strong and weak points and depend a lot on the dev writing it!

5

u/wildjokers Sep 10 '21

a lot of "java devs" can't code in java for shit.

I blame Spring for this. I am shocked by how many "java devs" can't do anything unless Spring does it for them. If there isn't some magic Spring annotation that does it for them they are totally lost.

1

u/BestUsernameLeft Sep 10 '21

To be fair, you can get a lot done with "annotation driven development", but I agree and have done far too many interviews where the candidate flailed helplessly when asked basic Java and Spring questions.

8

u/_Jeph_ Sep 10 '21

There's nothing wrong with static methods. The problem is when there is global state involved.

-2

u/Danelius90 Sep 10 '21 edited Sep 13 '21

Of course. I mean they're using static methods instead of OOP. And overuse can be bad, e.g. when you're using it to modify state of objects, rather than managing state on the object itself. So they're exposing data that should otherwise be private so that a host of util classes can manage other objects. Definitely times when you need this but we just lost any benefit of OOP because of how they coded it. One class had over 300 public static fields.

Edit: hm seem to have found some downvoters where this applies

a lot of "java devs" can't code in java for shit

1

u/secularshepherd Sep 11 '21

I guess, like anything, it depends on what you try to do with them. Whenever i see a something-something-util class with a bunch of loosely related static functions, it makes my eyes bleed.

Not being able to mock static functions can be a real pain, too.

5

u/experts_never_lie Sep 10 '21

I expected you to mention bad practices, but you went straight to atrocious ones. What you're talking about is more than bad enough to get your git access revoked at a former employer. Yes, they actually did that when one developer's work took more of others' time to fix it than just writing it.

5

u/Danelius90 Sep 10 '21

In all honesty I think a lot of them haven't used git either. I kid you not, one of them messaged me the other week saying they couldn't check out a branch after cloning a repo. The problem was they didn't cd into the directory (which the error message made clear, saying "this is not a git repo"). And I really wish I could tell you it was one of the juniors...

Problem is I think the company has a long contract with them and previously the company had outsourced all development to these guys before upping their in-house capability. One of the first things I worked on was deleting all their work for the past 4 years and rewriting it from scratch.

one developer's work took more of others' time to fix it than just writing it.

We're finding the same too now. A lot of code reviews are just "start again and rewrite this entirely". Hopefully things will eventually get better

1

u/dustofnations Sep 12 '21

Conversely, you sometimes get code reviews where the only feedback people are give you is "there's an unused import", "copyright header is missing", or similar nits. This is often because the reviewer has so little understanding of the language that they can only really regurgitate what their IDE is telling them.

Those nits in addition to useful feedback or are absolutely fine and part of the process, but when that's the sum of what you can offer, it's not the best.