A software design pattern concerned with allocating behavior and communication responsibilities among objects. Observer patterns notify dependents, while a command pattern represents a request as an object.
Separate operations from a relatively stable hierarchy of element classes. An element's accept operation calls the visitor overload appropriate to its own concrete type, combining virtual dispatch with static overload selection to obtain double dispatch. New operations can be added as visitors; adding an element type generally requires extending the visitor interface and existing visitors.
Delegate state-dependent behavior to a separate state object. Transitions replace that object, changing how subsequent requests are handled without spreading state tests through every operation.
Interchange algorithms through a common interface, allowing a client or context to select the policy without embedding every alternative in one implementation. Different strategies solve the same kind of task; the selected algorithm can be varied independently of its caller.
Articles by others on the same topic
There are currently no matching articles.