Chain Of Responsibility - Design Pattern

Can anyone get ma some doc on Chain Of Responsibility Design Pattern. Also some Detailed Real-time implementation as to why is this design pattern needed or what is the adv. of this pattern over others. Any explanation or detail related to this pattern will be appreciated.

Thanks,

Nazia

[306 byte] By [nazua] at [2007-10-2 5:05:57]
# 1
http://en.wikipedia.org/wiki/Chain_of_responsibility_pattern http://www.javaworld.com/javaworld/jw-08-2003/jw-0829-designpatterns.htmlCommons implementation: http://jakarta.apache.org/commons/chain/
aconst_nulla at 2007-7-16 1:09:17 > top of Java-index,Other Topics,Patterns & OO Design...
# 2
http://www.dofactory.com/Patterns/PatternChain.aspx
mchan0a at 2007-7-16 1:09:17 > top of Java-index,Other Topics,Patterns & OO Design...
# 3

The Chain of Responsibility pattern allows a number of classes to

attempt to handle a request, without any of them knowing about the

capabilities of the other classes. It provides a loose coupling between these classes; the only common link is the request that is passed between them. The request is passed along until one of the classes can handle it.

Use the Chain of Responsibility when

1 You have more than one handler that can handle a request and

there is no way to know which handler to use. The handler must

be determined automatically by the chain.

2. You want to issue a request to one of several objects without

specifying which one explicitly.

3 You want to be able to modify the set of objects dynamically that

can handle requests.

Rgds,

Seetesh

These are excerpts taken from DesignJavaPattern.pdf

seteshhindlea at 2007-7-16 1:09:17 > top of Java-index,Other Topics,Patterns & OO Design...
# 4

Thank yo so much for the info.

Well, can anyone explain to me as in how this chain of responsibility design pattern can be implemented in real-time applications. when & for what all it can be used in real-time app. [one eg. I had read is that in an application the occurence of Help is a Chain of Resp. design pattern]. Actually I got no idea as wat is a design pattern? & why is it needed if at all ? & wats the advantage of using a design pattern? I had gone through some of the links but since Im a beginner and not much aware of the basics of design pattern, I wasnt able to follow it with ease.

It would be great if anyone can explain the chain of resp. design pattern with a sample java code.

nazua at 2007-7-16 1:09:17 > top of Java-index,Other Topics,Patterns & OO Design...
# 5

> Thank yo so much for the info.

> Well, can anyone explain to me as in how this chain

> of responsibility design pattern can be implemented

> in real-time applications. when & for what all it

> t can be used in real-time app. [one eg. I had read

> is that in an application the occurence of Help is a

> Chain of Resp. design pattern]. Actually I got no

> idea as wat is a design pattern? & why is it needed

> if at all ? & wats the advantage of using a design

> pattern? I had gone through some of the links but

> since Im a beginner and not much aware of the basics

> of design pattern, I wasnt able to follow it with

> ease.

> It would be great if anyone can explain the chain of

> resp. design pattern with a sample java code.

Sorry you are finding it difficult to understand but a diagram in the javaworld reference above puts it as clearly and simply as I can imagine. Look there again after reading this...

The Chain of Responsibility Pattern describes a "Request" which is passed to a "Handler" object which may or may not be able to fulfill the request. If it can then fine but if not the request is passed to the next available handler, and the next, and the next and so on.

Hope that helps a little more.

Gargoylea at 2007-7-16 1:09:17 > top of Java-index,Other Topics,Patterns & OO Design...
# 6

> Sorry you are finding it difficult to understand but

> a diagram in the javaworld reference above puts it as

> clearly and simply as I can imagine. Look there

> again after reading this...

>

> The Chain of Responsibility Pattern describes a

> "Request" which is passed to a "Handler" object which

> may or may not be able to fulfill the request. If it

> can then fine but if not the request is passed to the

> next available handler, and the next, and the next

> and so on.

>

> Hope that helps a little more.

Hey thanks.. gargoyle!!

that was a real helpful piece of stmt. :)) that was good simple explanation for a novince like ma to go ahead & catch but wth tha details.

thanks once again.

nazua at 2007-7-16 1:09:17 > top of Java-index,Other Topics,Patterns & OO Design...
# 7
Great to hear.Perhaps you will be able to explain it to other developers soon then.Keep it up.
Gargoylea at 2007-7-16 1:09:17 > top of Java-index,Other Topics,Patterns & OO Design...