struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dakota Jack <>
Subject Re: Why Template Method instead of Strategy in Commons Chain?
Date Mon, 07 Mar 2005 21:50:39 GMT
With all due respect, Bill, I don't think this is quibbling.  The
actual use of these patterns has far-reaching consequences and this
"loose" way of talking about them IMHO is not helpful.  For example,
if the RequestProcessor were a template, it would have *had* to have
been plugged into the framework differently, Bill.  That's the point. 
This different way of plugging it in would have very helpful
repercussions.  Templates *enforce* an algorithm that subclasses must
override.  They don't just have an algorithm that subclasses might
override.  This enforcement is important.  It is as important as the
enforced encapulation in OOP.  I can remember when people in
procedural programming were saying, and still do, "C'mon, man, for all
intents and purpse its the same thing": you are just enforcing what we
do anyway.

Well, it isn't the same at all.  Just imagine that there were a real
abstract class that was in the code in Struts and that the existing
RequestProcessor were the concrete implementation of the class. 
Notice what would *have* to be changed and the options that would
suddenly be available.  That is what is important and is what the
pattern does for you.  I think that if you do this in your mind you
might agree on this point.

On the other score, i.e. Template Method and Strategy, I was
responding to real problems that have been discussed in relation to
the use of the commons-chain with the template method on the dev list.
 I am not just talking philosophy here.  The developers have run into
what I think are serious problems.  I think they think so too.  They
think so enough that some are having second thoughts about whether
using chain for these purposes will work well.


On Mon, 7 Mar 2005 16:04:12 -0500, Bill Siggelkow
<> wrote:
> C'mon man, for all intesive purposes its a Template -- it defines an
> algorithm that subclasses can override. As far as a way to specific
> alternative implementations -- there is, the <controller> element. But
> to me this whole conversation is moot. IMO, chain alleviates theses
> issues ... if you don't like how locale's are processed -- write your
> own class and all you have to do is implement Command  (or use a number
> of other approaches).  The use of the template method w.r.t to Struts
> use of chain is not something that I see as overly problematic --
> unless you think that any use of inheritance is wrong.
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message