'Chain of Responsibility' Design Pattern

'Chain of Responsibility' Design Pattern

This article describes the 'Chain of Responsibility' design pattern. This is a behavioral design pattern, a category of design pattern used by software engineers, when writing computer programs.

Introduction

The "Chain of responsibility" pattern is a design pattern, used in software engineering, to define the act of passing a piece of data down a chain of processors. Each processor decided whether to deal with the data or pass it straight on. A variation to this is the "tree of responsibility", where each processor can itself also deciede which direction to send the data.

It is defined as a behavioral design pattern because it affects what order the program acts on the data it is processing.

Benefits

Benefits of this pattern are that data is processed in a timely, queued and organised way.

This pattern also allows developers to easily add extra modules on the end of the chain, making the code more extensible.

Examples of the pattern

An example of this pattern would be processing of a log message. Different level log messages may be dealt with differently. For example, the first processor may just write it to file, but a later processor (if the log message is high enough) could email the message, or trigger an alert of some kind.

Another example is the collection of data for a report. An report class with an identifier could be passed through such a chain, each processor responsible for accessing it's own stores, for information to add to the final report. As extra systems are added, they too can be strapped on the end of the chain, providing extra information to the report class.


Return to Top


See Also

Link to domain parent articles and related articles in TechNet Wiki.

 

 

Return to Top


Community Resources

These are the external links, including links to Microsoft and TechNet sites that are non-Wiki

 

 

Return to Top


References section

Use this section if you pulled source material and ideas from other sites, blogs, or forums. Make sure you have permission from authors to use their material.

 

 

 

Return to Top


Leave a Comment
  • Please add 8 and 8 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Abhishek.Sur edited Revision 5. Comment: Added link to my Wiki, I should have contributed here, but I have already created all the patterns before. So I am going to add my contribution links to your wiki.

  • XAML guy edited Revision 3. Comment: added

  • XAML guy edited Revision 2. Comment: tidied sections

  • XAML guy edited Revision 1. Comment: tweak

  • XAML guy edited Original. Comment: tweak

Page 1 of 1 (5 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Abhishek.Sur edited Revision 5. Comment: Added link to my Wiki, I should have contributed here, but I have already created all the patterns before. So I am going to add my contribution links to your wiki.

  • XAML guy edited Revision 3. Comment: added

  • XAML guy edited Revision 2. Comment: tidied sections

  • XAML guy edited Revision 1. Comment: tweak

  • XAML guy edited Original. Comment: tweak

Page 1 of 1 (5 items)