You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by javabuddy <ma...@roomity.com> on 2005/08/31 01:05:27 UTC

Chain of commands

If there is an exception in one of the chain commands, will there be continous execution of other commands in the chain or it will terminate?


-----------------------------------------------------------------------------------------------------------------
Broadband interface (RIA) + mail box saftey = <a href="http://Struts_Developers_List.roomity.com">Roomity.com</a>
*Your* clubs, no sign up to read, ad supported; try broadband internet. ~~1125443127272~~
-----------------------------------------------------------------------------------------------------------------

Re: Chain of commands

Posted by Ted Husted <te...@gmail.com>.
Oops, 

* http://husted.wush.net/docs/display/BKS/ISBN-0201633612


On 8/30/05, Ted Husted <te...@gmail.com> wrote:
> 
> 
> * http://husted.wush.net/docs/display/BKS/Home/ISBN-0201633612
> 
>

Re: Chain of commands

Posted by Ted Husted <te...@gmail.com>.
On 8/30/05, javabuddy <ma...@roomity.com> wrote:What is the advantage 
gain if I use apache chain of commands???

The best resource is the Design Patterns book: 

"Chain of Responsiblity (223) Avoid coupling the sender of a request to its 
receiver by giving more that one object a chance to handle the request. 
Chain the receiving objects and pass the request along until an object 
handles it."

* http://husted.wush.net/docs/display/BKS/Home/ISBN-0201633612

In my own work, we find Chains to very testable and flexible. We now program 
almost everything in "baby steps", and use a Chain to put it all together. 
If a page needs three drop down boxes, we use a separate command to obtain 
the list for each one, and then put them together in a chain. If the page 
changes, we can just update the list of commands for the chain to add or 
remove whatever commands are needed. It also become quite easy to create 
"move" operations by chaining a copy and a delete. If the copy doesn't 
succeed, the delete never fires. Most importantly, we can write simple tests 
for each command, and test them in isolation, outside of the chain, and 
outside of Struts.


On 8/30/05, javabuddy <ma...@roomity.com> wrote:
> 
> If there is an exception in one of the chain commands, will there be 
> continous execution of other commands in the chain or it will terminate?


No. 

* 
http://jakarta.apache.org/commons/chain/apidocs/org/apache/commons/chain/Chain.html

Thought, any "filter" command will execute before the exception is rethrown. 


* http://jakarta.apache.org/commons/chain/

http://jakarta.apache.org/commons/chain/apidocs/org/apache/commons/chain/Filter.html

-- HTH, Ted.
http://www.husted.com/poe/