commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 33006] - [chain] Proposal: DispatchChain
Date Fri, 14 Jan 2005 15:03:28 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33006>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=33006





------- Additional Comments From sean.schofield@gmail.com  2005-01-14 16:03 -------
In response to William's earlier comments ...

Having a method implement two or more "command" methods is still in keeping 
with the spirit of the Command pattern (IMO).  I would tend to agree with some 
of your points when it comes to the use of a single DispatchCommand 
(especially about the method being arbitrary.)  But I think it becomes much 
more powerful when you consider a chain of dispatch commands.

Consider you have a group of commands with a foo() and bar() method.  Now you 
can group these together into a single chain.  Then whatever code is calling 
the chain can execute either the foo() "sequence" or the bar() sequence ( or 
both - one at a time obviously).  

You've effectively established the common "command" method to execute 
dynamically but its definitely not arbitrary in this case.  I definitely have 
some uses for this in my code right now.  There are cases where I could have a 
command related to each section of a document that is managed by my app.  
These commands can inherit from a common abstract command that defines the 
dispatch methods that need to be provided.  Each time you add a new section to 
a document, you just create a new command that extends the abstract one and 
add it to the catalog.  You have a single catalog to maintain and the rest of 
the code that knows what method in the chain to call and when remains 
untouched.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message