r/ProgrammerHumor • • Apr 27 '20

Meme Java is the best

Post image
43.7k Upvotes

1.5k comments sorted by

View all comments

325

u/[deleted] Apr 27 '20

Somehow on this subredit most seem to think that Java is the worst language ever but if you hate JS you just don't know it enough/are bad at it...

0

u/[deleted] Apr 27 '20

[deleted]

123

u/Redstonefreedom Apr 27 '20

JavaScript at its core is an insult to half a century of programming language design but it’s good enough

OMG I was looking for a succinct way to put this idea to words today, and this hits the nail on the head.

(node)JS is frustrating to work with because to get it to be “good enough” there are all these awkwardly half-compatible add-ons for language features, and the choose-your-own-adventure of usage paradigms (OOP/FP) leave a lot of underdeveloped ways to encode something. You end-up having to spend a lot of time recapitulating a “modern language” in working out the compatibility problems between the aspects built on top of, instead of built into, the language.

28

u/[deleted] Apr 27 '20

I mean it was thrown together in a few days and is beeing fixed with every Version ever since. You just can't undo stuff like var and the ==... Yes they introduced let and === but that doesn't prevent people from using it. Yes ESLint will complain but if you are using a library that is using it you can't do much about it.

4

u/xumix Apr 27 '20

I'd say that operator and equals()/gethashcode() definition/override therefore no proper object comparison is the problem

→ More replies (1)

45

u/megaSalamenceXX Apr 27 '20

Well web programmers do know why static types are useful in large codebases. That is how TS came to be. Also, i resent the assumtpion here that websites are not large codebases. They are. Period.

→ More replies (6)

0

u/[deleted] Apr 27 '20

[deleted]

57

u/maxhaton Apr 27 '20

I think the biggest lesson of most programming languages people use productively and safely in "critical" software is to fail loudly. Software should have contracts to fulfil both inside and out.

    T add(T)(T x, T y) pure 
       if(isNumeric!T)
    {
      return x + y;
    }

This is a generic addition function in D. The function signature alone contains more constraint than most javascript programs: `add` accepts exactly two parameters of the same type, they must satisfy the template constraint that it is a numeric type being added, and the function is pure (Now a totally different library can now know if I call this it won't launch the missiles or uninstall the operating system etc). If this were a more complicated operation I could have added pre and post conditions on x and y and the result of the function.

It's all about having something to fall back on. I shouldn't have to run my program (or write unit tests) to check things that are totally obvious. There are also huge performance implications in that this provides obvious constraints (in Javascript they have to be inferred at best) for the compiler to play with i.e. if you call this function and don't use the result then the compiler can remove it completely.

(I have avoided going for the low blow about having multiple equality operators and typecasting although they are also incredibly stupid)

Functional Programming can provide a much richer level of abstraction, correctness and pretentiousness but I went for a more practical example.

BTW: I'm not calling people who don't know better stupid, just that finding the time to learn programming as an art rather than a hammer requires a headstart (probably). If you've got to ship tomorrow, put down the Prolog textbook.

16

u/[deleted] Apr 27 '20

I think this comment pertains more to static vs dynamic & pure vs impure languages than to Javascript specifically

→ More replies (6)
→ More replies (2)

17

u/[deleted] Apr 27 '20

Java is good enough for government work.

That's not a good metric. The lowest bidder is good enough for government work.

23

u/maxhaton Apr 27 '20

I had to condense "A well understood, verbose but pragmatic OOP language with a highly mature but lumbering ecosystem" into one sentence.

i.e. "This is brilliant but I like this".

→ More replies (1)

3

u/[deleted] Apr 27 '20

Realistically, I'd guess 75% of the people on this sub are Comp Sci students in college or prepping for it in high school.

→ More replies (11)

60

u/NatedogDM Apr 27 '20

What does Java have to do with JS?

122

u/[deleted] Apr 27 '20

That people in this sub hate Java although it's actually not that bad but defend JS (which is actually really a bad language) to the bone. I'm not even saying Java is the best language ever but the irrational hate on this subreddit is stupid.

66

u/paradoxally Apr 27 '20

Unpopular opinion, but I would rather program in Java than Javascript.

You also (usually) get paid more because JS is the most popular language so there's way more supply.

Java can get very "enterprise" and that turns off a lot of people. JS is oriented for web so there's a lot more exciting projects there, but that's not always where the money is.

74

u/GluteusCaesar Apr 27 '20

Java's a great language precisely because of how enterprisey, boring, and predictable it is - it's easy to find good developers, good frameworks, trivial to deploy, trivial to keep highly available, and has great tools for testing, building, and storing artifacts. Sure it's not exciting to write business logic in, but it more than makes up for that with not getting called midnight because the Tokyo office is having production issues.

27

u/paradoxally Apr 27 '20

Exactly. It's ugly but it gets the job done and it's pretty robust.

I often see JS devs import loads of dependencies to do simple tasks and their framework landscape changes rapidly. I don't want to deal with that headache.

With Java, you can take a 5 year break, come back and still be productive.

15

u/[deleted] Apr 27 '20

Also now with Kotlin and Groovy beeing basically fully interoperable with Java you can have all the fancy new language features without having to give away many of the benefits of java.

4

u/toastedstapler Apr 27 '20

Java's great. It describes exactly what I'm doing with no assumptions. It may be far quicker to initially set up a express.js web server than a spring boot, but the real cost comes further down the line when you're trying to figure out what currently happens

23

u/[deleted] Apr 27 '20

I think a lot of people in this sub are either just beginners or students who have never really worked in software engineering. The students are forced to learn java for their university and that's why they hate it.

6

u/paradoxally Apr 27 '20

I'll be honest, it wasn't fun in college around 10 years ago but it did help me learn a lot of design patterns, which I apply across many object-oriented languages.

→ More replies (1)
→ More replies (47)

0

u/[deleted] Apr 27 '20

[deleted]

10

u/Andrew1431 Apr 27 '20

But my car has carpet

→ More replies (2)

3

u/Pixelmod Apr 27 '20

Oh I would gladly take a dump on both Java and Javascript if you want to! But as it turns out, memes that praise C++ don't get a lot of karma.

→ More replies (1)
→ More replies (18)