On 8/30/05, javabuddy <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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/