Chain-of-responsibility pattern

This is an old revision of this page, as edited by JoaoRicardo (talk | contribs) at 04:44, 1 February 2005 ({{Compu-stub}}, removed "see also" for non-existing articles). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In computer programming, chain-of-responsibility pattern is a design patterns where command objects are coming from somewhere, their processing logic is spread between a number of objects and the commands are distributed among those objects. Each object is smart enough to know which command objects it can handle, how to pass off command objects it can't handle, and how to add to the end of the chain.

Permutations: Commands may be sent in alternate directions out, forming a tree of responsibility. Recursion could continue until the command is processed, or the entire tree has been explored. An XML interpreter (parsed, but not yet executed) might be a fitting example.

This pattern promotes the idea of loose coupling, a programming practice.

The article is originally from Perl Design Patterns Book

Disambiguation