Changes

Jump to: navigation, search

Chain of Responsibility

67 bytes added, 16:13, 2 April 2007
no edit summary
----
== Chain of Responsibility (Behavioral Pattern) ==
 
* The '''Chain of Responsibility''' pattern uses a chain of objects to handle a request, which is typically an event. Objects in the chain forward the request along the chain until one of the objects handles the event. Processing stops after an event is handled.
[[Image:CoR1.jpg]]
 
----
== Purpose ==
* Avoid Is to avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it.
[[Image:CoR_UML.jpg]]
 
The role of every class:
 
*'''Handler''' - defines an interface for handling requests
*'''RequestHandler:'''
----
==Applicability==
 
Here are a few situations when using the Chain of Responsibility is more effective:
 
* More than one object can handle a request
* The group of objects that may handle the request must be specified in a dynamic way
 
----
1
edit

Navigation menu