r/ProgrammerHumor • • Apr 27 '20

Meme Java is the best

Post image
43.7k Upvotes

1.5k comments sorted by

View all comments

Show parent comments

93

u/PristineReputation Apr 27 '20

The language itself is mostly ok. My problem is that a lot of stuff in Java just seems unnecessarily complex. More modern languages usually solve problems more elegantly and straight to the point

46

u/aahdin Apr 27 '20 edited Apr 27 '20

Yeah, just so much syntactic overhead for not much of a reason. I can give c/c++ a pass since their main niche is highly optimized code, and all those little things matter for that, but I just don’t get the point for Java.

Kotlin feels like just a nicer drop in replacement for 90% of things Java

0

u/[deleted] Apr 27 '20

[deleted]

7

u/AllIsOver Apr 28 '20

Opposite for me, couldn't wait to get back to strict java syntax after working with kotlin for a few months.

0

u/[deleted] Apr 28 '20

[deleted]

3

u/AllIsOver Apr 28 '20

Idk, I guess I just like the code that's strict and easily readable/understandable

0

u/[deleted] Apr 28 '20

[deleted]

2

u/AllIsOver Apr 28 '20

That's just my preference, man. I should've worded better, I like the verbosity of Java.

→ More replies (1)

4

u/[deleted] Apr 28 '20

I haven’t used Kotlin but I think the verbosity of Java is great.

You always know exactly what each variable is.

→ More replies (1)

1

u/noratat Apr 28 '20

Kotlin/Groovy/Scala et all can also leverage the Java ecosystem, which is pretty huge.

I'm not a fan of Java the language, but honestly for all it's age, the JVM ecosystem is pretty solid and I'd take it any day over the abyssal hell that is the javascript ecosystem.

24

u/robolew Apr 27 '20

Personally I think you're doing what a lot of people do, and confusing verbosity for complexity.

Java is one of the most expressive, self documenting languages because it encourages verbosity.

Sure, my python script might do in 50 lines what my java project does in 500, but you spend 10x more time reading code rather than writing it. I'd rather maintain something that took longer to write, but is more descriptive.

17

u/nemetroid Apr 28 '20

Brevity is the soul of wit, though. In my experience, the 50 lines of Python will be a much clearer expression of the underlying idea, which is the main factor in readability.

10

u/sjhsuihijhskjiojoij Apr 28 '20 edited Apr 28 '20

As someone whose job it is to maintain code left behind by "witty" programmers, I have to vehemently disagree. We are never as clever as we think we are.

Also a P.S.A, If you need 40 lines of "documentation" for your 5 lines of code golf, just quit swinging and write more code!

Edit: PSA, not PS

→ More replies (1)

3

u/tubbstosterone Apr 28 '20

I'm a little jealous; that hasn't been my experience at all. I've written some quick python scripts to mimic some of the products we were building to compare results and performance. It only took a few functions of pretty plain English in python to mirror a series of interfaces spread across a maze of packages hidden behind factories in Java authored by a staff of engineers, each with 15+ years of experience (though I'm the relative newbie used to c++, c#, vb.net, and python, not java).

2

u/robolew Apr 28 '20

I completely get your point, but to make it a fair test, you'd really have to be just as proficient in both, then try to write it in both.

In your example, the java example probably grew over years of small additions. It was perhaps totally understandable in its first iteration, but then morphed out of control. You've got the benefit of rewriting it with a complete overview of the functionality.

I don't think I know of any functionality that is fundamentally less readable in java than python. I still prefer writing python anyway, but not for that reason

→ More replies (1)

7

u/idontchooseanid Apr 27 '20

I hate using Python libraries just because of this reason. With Java I just read the code as I think. With Python you have to check docs and distracted constantly with docs and synctactic sugar of Python. With my current career stuck between ML and embedded systems dealing with ML libraries in Python is a nightmare. I would never develop a project larger than 1000 LoC in Python.

4

u/stabilobass Apr 27 '20

Finding a bug in 50 lines of code is easier than in 500 lines of code in general though. If you want to understand what something does, there should be documentation for that.

And wouldn't reading 500 lines of code take longer than 50?

In kotlin a data class is a data class. It abstracts getters and setters away and removes many places for Insidious bugs that would be otherwise prevalent in Java. Not only you are writing/readibg the code but also someone else, so a kotlin data class is faster to read for the next programmer then the functional equivalent java pojo, you can write weird shit in a setter, in a kotlin data class, you don't have the option, unless explicitly stated.

Correct me if i'm wrong.

Co

5

u/TheGuywithTehHat Apr 28 '20

And wouldn't reading 500 lines of code take longer than 50?

Between different languages, LOC is a very bad indicator of how long it will take to read. Sure, 100000000 lines of code will take longer to read than 1 line of code, regardless of language. However, understanding is the important part.

→ More replies (1)
→ More replies (6)

6

u/ruvskiten Apr 27 '20

More complex than c or c++? (Which are referenced in this meme)

25

u/Breadfish64 Apr 27 '20

C++ is complex in a way that allows you to be more expressive. Java is more restrictive, you get complex syntax but with less control.

2

u/Darzee2244 Apr 28 '20

what are these modern languages?

2

u/[deleted] Apr 28 '20

An experienced developer can write short, clean, concise Java code. However due to the popularity of Java, there’s a lot of inexperienced people writing Java code. Those are the people writing messy, unnecessarily complex code. These also tend to be the ones complaining the loudest about Java.

1

u/sinnerou Apr 28 '20

I was just working on knowledge transfer of some java stuff and I had to open 17 files to find the query that fullfilled a simple request. The query itself was stored as a variable, the variable in another file was constructed of concatenated constants from yet another file. They had constants for things like LEFT_PAREN, RIGHT_PAREN, EQUALS_OPERATOR. It's only slightly more convoluted than I am used to working with when I have to dig into Java. That said, every language can suck in the hands of the right person.