Generalization tends to be overused, much like aggregation. Remember that generalization does generate different code, so be sure that you are using it properly. Some design pattern texts use alternatives to generalization that provide more control.
The delegation technique makes one class a part of another class, using aggregation. When the containing class requires assistance it simply forwards, or delegates, the request to the component class. When the component class is finished with the delegated task it returns control to the requestor.
Delegation is a common technique for allowing one class to get help from another class without using inheritance. To give one class access to another, follow these steps:
UML Delegation Textbox
For another application of the delegation technique, look at the
State design pattern.
This pattern can be very helpful in an application that requires complex state behavior.
The next lesson concludes this module.