Re:Fluent Interfaces Are Bad for Maintainability
by snarfy on Tuesday March 20, 2018 @07:38AM
(#16627617)
Even without that support, if you return interfaces instead of the concrete type each return can be a different implementation. There is no need to have one giant class. All of those methods in his example should return IJdkRequest, not JdkRequest.
[ Parent
| on HN ]
Re:Fluent Interfaces Are Bad for Maintainability
by Sharlin on Tuesday March 20, 2018 @08:05AM
(#16627759)
That doesn't help at all because all the methods will still have to be declared in IJdkRequest and implemented by every concrete subtype returned by the methods.
Re:Fluent Interfaces Are Bad for Maintainability
by snarfy on Tuesday March 20, 2018 @09:18AM
(#16628264)
IJdkRequest would inherit other interfaces, so the other methods would be declared there. The default implementation could be handled by a base class.
And now that I typed it out, I see how it also doesn't really help. I see your point. I'm not sure what's worse, one giant class, or the handful of interfaces and abstractions just to make it work in multiple classes.