January 2017
Intermediate to advanced
420 pages
9h 25m
English
You might have already heard about the delegation pattern or at least used it without even knowing it had a name. It allows a type to forward one or more of its methods call to a different type. Therefore, you need two types to achieve this: the delegate and the delegator.
This could easily sound like a proxy pattern, but it isn't. A proxy pattern is meant to provide a placeholder for an instance to get full control while accessing it. Let's say you are writing a UI framework and you start where your abstraction is UIElement. Each of the components define a getHeight and getWidth.

Class delegation via association
Below you see the ...
Read now
Unlock full access