3 ms·
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 gi
by snarfy 9y ago
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.
- Sharlin 9y agoThat 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.
- snarfy 9y agoIJdkRequest 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.