Re:Fluent: Static Extension Methods for Java
by sacnoradhq on Monday July 03, 2023 @07:53AM
(#36571650)
You're oversimplifying the use of continuation / builder pattern / "fluent" / monadic interfaces.
vs.
https://java-design-patterns.com/patterns/fluentinterface/
[ Parent
| on HN ]
Re:Fluent: Static Extension Methods for Java
by rogerkeays on Monday July 03, 2023 @09:22AM
(#36572518)
Nice example. The extra parameters really drive the point home. Hope you don't mind if I steal it for the README.
Re:Fluent: Static Extension Methods for Java
by jdmichal on Monday July 03, 2023 @12:41PM
(#36575432)
Or, in my opinion, even worse... When you get mix-and-match because you want to extend a fluent API. Using your example, what if `SetWriteTimeout` was a static method you wrote, but all the others were provided by library as a fluent API? Then you end up with this kind of unholy mess:
SetWriteTimeout(FactoryClass.factory().SetConnectTimeout(100), 2000).SetReadTimeout(4000);
Good luck correctly guessing the order of operations on that in a quick read...
Re:Fluent: Static Extension Methods for Java
by erik_seaberg on Monday July 03, 2023 @02:43PM
(#36577209)
This, having to remember which methods are implemented inside the class and which ones should have been is almost like the colored function problem.