Live data from Hacker News

Java is still worth learning

empatheticdeveloper.wordpress.com

81–82 of 82 posts

Re: Java is still worth learning

#81
post #36

Earlier quoted context omitted.

I get the point you're trying to make, but there's something ironic about touting a language as "simple" immediately followed by mentioning that using the basic equality operator that's used by pretty much every other mainstream language is "madness". I know every language has warts, but that one is pretty egregious both in terms of how quickly people would run into it for the first time and how easily it could have…

Fair criticism, but it's not really a practical problem. Usually a linter will catch them easily, and even when junior devs ignore the warnings, you can just tell them to use "equals." The thing is that, equality is the difficult problem. "equals" in JVM languages has a lot of problems. Dynamic languages are much more horrible in this aspect. JavaScript `==` is much worse than Java. Python is guilty too in my view, f…

It's a subjective thing, but to me, having the usage be intuitive even if it means doing a custom implementation is a bit less intuitive is still "simpler". A person in their first day of writing Python code can use `s == "some_string"` and it will work like they expect, and they typically will only need to learn about `__eq__` when they've spent a lot more time writing Python code. With Java, they might literally have to learn that `s == "some_string"` won't work the way they expect and that they need to use `.equals` instead.

JavaScript has an entirely different level of issues, where at first glance it _looks_ like `==` works the way you'd expect, and the issues start cropping up when you accidentally rely on assumptions like equality being transitive. I agree that this is much worse than Java, but it doesn't change the fact that Java still doesn't strike me as the simple, straightforward language you tout it to be. I'd argue that the measure of how simple it is to learn a language should be measured both by how quickly you run into behavior where you need to start caring about the underlying implementation and by how intuitive (or unintuitive) the underlying behavior you need to care about is. At least with regards to comparing equality, Python beats Java by that measure because it abstracts away the concerns about how to define equality from the concerns about how to actually perform the comparisons, and Java beats JavaScript because the extra knowledge you need to be able to compare equality correctly being way more straightforward.

Re: Java is still worth learning

#82
post #71
post #60

I've been hating Java since 1999 for many reasons, yet I'm a Java Developer since then (with episodes of Python, C, C++ and Qt). The language itself got on my bad side when the Java developers said that they will not implement operator overloading (I'm a little bit crazy about the subject) because - EKHM - it would allow writing unclear code, which is bananas. Things missing in Java: - .? operator - operator overload…

Seconded on operator overloading, but being restricted to the limited set of "primitive" (value) types is horrible too. Complex numbers are table stakes. The idea that I need to dynamically allocate an object holding two floats and hope the JIT can optimize that into a stack value is awful.

Actually using the record at the moment might be almost a guarantee of success. Java JIT is great!
Post reply on HN