3 ms·
> What if you want to add in extra layer, or remove a layer, or add a helper. You make the extra layer implement the same interface and delegate to the origina
by ptx 6y ago
> What if you want to add in extra layer, or remove a layer, or add a helper.
You make the extra layer implement the same interface and delegate to the original object. Classes don't depend directly on other implementation classes in this style.
- UK-Al05 6y agoThe extra layer will transform the objects somewhat, so you would have to change what the original object would accept. You have now broken the tests against the original object.
- ptx 6y agoI think the idea is to have small and well-designed interfaces so that you don't need to change them to insert a layer.