News for hackers. Stuff that matters.
Re:Java Is Underhyped by pydry on Friday April 16, 2021 @05:22AM (#26831547)
The crap people created on top was typically responses to deficiencies in the language, whether they knew it or not.

Stuff like "everything is a class".

Re:Java Is Underhyped by doctor_eval on Friday April 16, 2021 @07:23AM (#26832517)
I don’t think that’s true at all. Like most languages, Java has its share of deficiencies - I’d personally put null handling, type erasure and brain dead Optionals near the top of my list of things I’d change if I was King of Java - but fluent APIs and factory methods didn’t even start with Java, and have nothing to do with “everything is a class”.
Re:Java Is Underhyped by Pet_Ant on Friday April 16, 2021 @10:03AM (#26834005)
What is wrong with Optionals?
Re:Java Is Underhyped by doctor_eval on Friday April 16, 2021 @07:37PM (#26840223)
Optionals can be null, so dereferencing them can still cause an NPE. Also the syntax is horrible.

I know the excuse that they are just meant to be used to wrap the return value of a function that might be null, rather than as a guard against NPEs, but that just means we’ve got a crappy, verbose Optional class ... and NPEs.

It was the most half assed attempt to fix the billion dollar mistake [0] anyone could have come up with. It needed syntax and compiler support, not a stupid wrapper class.

[0] https://en.m.wikipedia.org/wiki/Tony_Hoare

Re:Java Is Underhyped by Pet_Ant on Saturday April 17, 2021 @11:18AM (#26844886)
Sorry but of course Optional can be null because of Java’s type system. Objects can be null, Optionals are objects. I’d rather it have been different from the beginning but now that it’s here it’s really not something that should change. Just never let anyone get away with returning a null for an optional... though I can imagine the scenario where in. A framework that might cause it to happen. To have special rules for Optional in Java is the wrong answer for a blue collar language at this level of adoption and age. They said they never want to make a change as big as generics again.
Re:Java Is Underhyped by doctor_eval on Sunday April 18, 2021 @03:57AM (#26850676)
I think you’ve read me out of context. Of course I understand why Optionals can be null, I was just pointing out - literally in defence of Java - something I don’t like.

I don’t really get your other arguments. I think the problem has been solved better in other languages including Swift, Kotlin and Rust, and Java could have learned from them, but didn’t. I can’t see why direct language support couldn’t have been added to solve this “billion dollar problem”. Even the Elvis operator would have helped.

Re:Java Is Underhyped by sk5t on Friday April 16, 2021 @10:23PM (#26841129)
Likely to be addressed with the ongoing effort for value types. Optional + prudent use of @NotNull annotations can get you most of the way there already in practical terms.
Re:Java Is Underhyped by blacktriangle on Friday April 16, 2021 @08:34AM (#26833082)
I have a saying for that: design patterns are a language smell.
Re:Java Is Underhyped by pydry on Friday April 16, 2021 @09:37AM (#26833690)
Ha. Good one.

I'm absolutely convinced that's true for some of them. I was never 100% convinced it was true for all of them.

Re:Java Is Underhyped by BiteCode_dev on Friday April 16, 2021 @05:30AM (#26831622)
Design design does lead community culture.

Java also had the unfortunate destiny of becoming popular at the time where "OOP all the thing" was a mantra in tech circles. Also design pattern were all the rage.

Those things have a huge inertia, and while Java is not a much more flexible language, the image stuck, to the point that new comers still implement singletons in the wild.

Re:Java Is Underhyped by dragonwriter on Friday April 16, 2021 @05:36AM (#26831669)
> Java also had the unfortunate destiny of becoming popular at the time where "OOP all the thing" was a mantra in tech circles.

Java was a product of “OOP all the things”, it wouldn’t have existed without it.

Re:Java Is Underhyped by pydry on Friday April 16, 2021 @05:35AM (#26831652)
Java created that hype to market itself. OOP all the things probably wouldn't have been a thing without it, for instance.

It was very much a marketed language and a language designed to be sold to top heavy corporations. This fueled a lot of the crappy design decisions, the hype and the culture.

Re:Java Is Underhyped by dragonwriter on Friday April 16, 2021 @05:41AM (#26831708)
> Java created that hype to market itself. OOP all the things probably wouldn't have been a thing without it, for instance

“OOP all the things” predated (and led to) Java, it wasn’t a product of Java (C++, Objective-C, Object Pascal and, well, a bunch of other things from the late 1980s and early 1990s were where it got started.) Java was about a decade into it.

Re:Java Is Underhyped by pydry on Friday April 16, 2021 @08:28AM (#26833035)
There's a big difference between "OOP is cool" (which Java didn't invent) and "OOP ALL of the things".
Re:Java Is Underhyped by doctor_eval on Saturday April 17, 2021 @05:18AM (#26842826)
But Java clearly didn’t “OOP all the things”, unlike earlier languages like Smalltalk. Java primitives are not objects (despite the fact that I often found myself wishing they were), and static methods are actually just functions. These days Java even supports first-class functions.

I know not everyone will agree with me, and that’s fine, but I always found Java to be far more pragmatic than, for example, C++, which well and truely predated Java.