Re:Virtual Threads Arrive in JDK 21, Ushering a New Era of C...
by kaba0 on Wednesday April 12, 2023 @07:57PM
(#35548848)
> If I could change Java then the thing I’d do is I’d make it necessary to declare all exceptions in a method, but get rid of ~~caught~~ checked exceptions
That's pretty much what javadocs contain already
Re:Virtual Threads Arrive in JDK 21, Ushering a New Era of C...
by peterashford on Thursday April 13, 2023 @07:58AM
(#35554076)
Name one FactoryFactory in the JDK
Re:Virtual Threads Arrive in JDK 21, Ushering a New Era of C...
by doctor_eval on Thursday April 13, 2023 @05:09PM
(#35562090)
FactoryFactory is (or was) a well known parody of the multiple levels of abstraction Java developers were encouraged to make when performing even simple tasks. This started with an insistence that we should use getters and setters for field access, and it basically went downhill from there.
This kind of nonsense was endemic to the Java engineering culture while I was working in it.
Perhaps the worst example I saw was during the fluent API craze where someone in my team replaced a constructor call for a Button with five lines of fluent Builder pattern gibberish.
The point of mentioning FactoryFactory was to poke fun at the culture surrounding Java, which ended up being one of the reasons I stopped using it, because idiomatic java stopped making sense to me.
Hopefully it’s changed now.
But I can say honestly that I prefer Go’s error handling, which I find tends to result in errors which are actionable. I think it takes a lot more effort up front to get Java exceptions to work rationally.
If I could change Java then the thing I’d do is I’d make it necessary to declare all exceptions in a method, but get rid of caught exceptions. So you can see what’s coming, even if you don’t have to deal with it.
In terms of stream operations, well, I write a lot of typescript lately and just like in Java, I find that I end up having to fall back to regular loops quite often. I’m not convinced that stream operations are useful in as many use cases as people would like. For example, the moment something can throw an exception, things are going to get gnarly.