Jump to content

Talk:Chain-of-responsibility pattern

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Loek Bergman (talk | contribs) at 09:19, 16 June 2009 (Is the example correct?). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
WikiProject iconComputer science Stub‑class
WikiProject iconThis article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
StubThis article has been rated as Stub-class on Wikipedia's content assessment scale.
???This article has not yet received a rating on the project's importance scale.
Things you can help WikiProject Computer science with:

Problem statement needed

Design patterns are general reusable solutions to a commonly occurring problem in software design. This article doesn't describe the problem the pattern aplies to. --89.155.228.227 (talk) 16:11, 1 March 2009 (UTC)[reply]

Pattern Application

Would appreciate an example in which applying this pattern resolves a design flaw... Thanks -- User:Euyyn

Is the example correct?

I think the output is not correct. "Writing to stdout:" should be "Writing to debug output:", or vice versa. But in this state I think the output does not match the Java source. - Regards Carsten —Preceding unsigned comment added by 80.144.237.11 (talk) 12:48, 31 July 2008 (UTC)[reply]

By my reading of how this pattern works, each successor is called until a successor in the chain handles the call. Then the chain stops. This is stated at the top of page 224 of the Design Patterns book. The example for Java shows each item on the chain being able to perform some example. So I don't think it is an actual example of a 'pure' chain of responsibility. Pcraven 20:10, 11 February 2007 (UTC)[reply]

I agree with Pcraven. Java example contradicts this statement "Each processing object contains a set of logic that describes the types of command objects that it can handle, and how to pass off those that it cannot to the next processing object in the chain." The example passes on the responsibility to next logger even if it could handle it. Sameergn (talk) 03:42, 8 March 2009 (UTC)[reply]

I agree and disagree with Pcraven. The Filter chain in the Servlet API is an implementation of this pattern. In the Filter chain the processing is continued just like the example, but in contradiction to the definition provided by the GoF. IMHO I think the people of SUN have thought thoroughly about the choice for this pattern. It turns out that the pattern can be used in a different setting then thought of by the GoF. Because I knew the FilterChain before reading the description by the GoF I was actually surprised to find out that the chain would stop. But thinking of selection of jdbc drivers made me understand. I think this example is correct although quite rudimentary and another example could be added to show the original way how the CoR can do its job. Loek Bergman (talk) 09:17, 16 June 2009 (UTC)[reply]

Multiple language examples

Please stop removing examples without any discussion. There's some useful info there. Please discuss why we shouldn't have all these examples, instead of wholesale removing them. Thank you. peterl 11:05, 5 March 2007 (UTC)[reply]

Class Diagram

I was really expecting a more theoric example with diagrams and such... I think it is really useful to anyone who want to understand the pattern and apply into their project...189.59.206.104 (talk) 17:21, 16 July 2008 (UTC)[reply]