Delegation, is this just opinionated or is there a common pattern?
- by user1446714
If I have a java class containing substantial code and I wish to add extra features, am I right in thinking the delegate class would have the additional features added as methods. Then my original class would create the delegate object and just call the extra functionality via the delegate instance?
I am being told by somebody else that my original class should become the delegate and that the class containing the new functionality should contain an instance of the original class, to use as a delegate? This seemed a little backward to me, because there would be far more delegate calls because most of the code is now in the delegate....
I was always under the impression the delegate object would contain the additional new behaviour and an instance of it would be in the original class to inboke the new behaviour from?