Jump to content

Chain-of-responsibility pattern

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by TakuyaMurata (talk | contribs) at 20:41, 3 January 2003. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Intent: 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.

An example of this pattern is the $PATH environment variable on unix machines.


http://rampages.onramp.net/~huston/dp/chain.html

http://wiki.cs.uiuc.edu/PatternStories/ChainOfResponsibilityPattern

Net'Beans Multi'File'System http://www.netbeans.org/download/apis/org/openide/filesystems/MultiFileSystem.html

"Plan 9 has union directories: directories made of several directories all bound to the same name. The directories making up a union directory are ordered in a list. When the bindings are made (see bind(1)), flags specify whether a newly bound member goes at the head or the tail of the list or completely replaces the list. To look up a name in a union directory, each member directory is searched in list order until the name is found. A bind flag specifies whether file creation is allowed in a member directory: a file created in the union directory goes in the first member directory in list order that allows creation, if any. " http://plan9.bell-labs.com/magic/man2html/1/intro

The PowerPlant framework used (uses?) this pattern to dispatch events from the actual target (button) up to its super-'commanders' (window, application).


CategoryPattern | CategoryBehavioralPatterns