CBR Logo


CBR*Tools Documentation


B1.Abstract Factory


B2.Adapter


B3.Chain of Responsibility


B4.Composite


B5.Facade


B6.Factory Method


B7.Iterator


B8.Prototype


B9.Strategy


B10.Template Method


Logo of Inria at Sophia Antipolis


French flag - link to the french documentation


Return to the Action AID
main page

Annex B: Design Patterns

B3. Chain of Responsibility

Description

When several objects are likely to be able to treat a request according to the context, this pattern allows to avoid the direct coupling between the sender of the request and its processing by one of the potential receivers. A chain of receiving objects then is made up and traversed until one of them handles the request.



Structure and Components

Structure and Components of the Chain of Responsibility design pattern

Structure and Components of the Chain of Responsibility design pattern

  • Handler defines the interface of a receiver of requests,
  • Handler1 and Handler2 concretely treat a request or pass it to their successor,
  • ChainClient sends a request.

Collaborations

The request sent by the client is transmitted along the chain until its effective processing.

Collabotations of the Chain of Responsibility design pattern

Collabotations of the Chain of Responsibility design pattern

Strengths and Weaknesses

Plus sign reduction of the coupling between the client and the processing of a request by a set of objects which do not know in advance which effectivelly will be handling the request,

Plus sign possibility of dynamically modifying the way of handling a request,

Plus sign flexibility in the allocation of the responsibilities for handling in the objects of processing,

Minus sign following to the constraints of design, the processing can not be guaranteed.

Use in CBR*Tools

A design of retain uses this pattern to make the decision of the addition of a case and its indexing into the memory. A chain of decision-makers is then formed, in which each element prepares according to a criterion the response to this request.




Valid XHTML 1.0! Valid CSS! Brigitte Trousse
Last modified: Fri Sep 28 13:51:31 MEST 2001