struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dakota Jack <dakota.j...@gmail.com>
Subject Re: Why Template Method instead of Strategy in Commons Chain?
Date Mon, 07 Mar 2005 00:34:47 GMT
I think I stated the problem badly, Eric.  If you look at the
implementations of commons-chain you will see the implementations tend
to use Template Method.  The chain is used to solve the rather
troublesome problems with that pattern, and yet the people who go to
all the trouble to change to chain do so while staying with the
Template Method.  The move to chain, in my opinion, allows us to get
free of the Template Method and to use Strategy instead.  Bill's
article is about the use of Template Method with chain and the propsed
changes in Struts v1.3 use Template Method with chain.  Chain solves
many of the problems with Template Method, but my suggestion is that,
if you are going to implement chain and make that big change in v1.3
anyway, why not switch to Strategy will doing so and abandon all those
problems.  (I am, perhaps, overstating the problems with Template
Method a bit,, but this seems to be okay given that there is a better
option available with Strategy.  I think people generally agree that
Strategy is a better pattern that Template Method to do the same
thing.)


On Sun, 06 Mar 2005 18:22:44 -0500, Erik Weber <erikweber@mindspring.com> wrote:
> I think it's probably usually good to question Template when the
> realization of it comes via class inheritance.
> 
> However, I'm confused. I read Bill's article (first pass anyway -- and
> I'm new to Commons Chain), and I'm still not seeing where exactly
> Template is implemented in Commons Chain. He introduces Template and
> then seems to say that while Template is still used, its detriments are
> mitigated. But I need help understanding exactly where it is used in the
> first place. (I'm not making the connection between the first code chunk
> and the following ones.) Only then will I be able to assess the question
> of whether Strategy would be better (or would even solve the same problem).
> 
> Here's a diagram of Template:
> 
> http://www.dofactory.com/Patterns/PatternTemplate.aspx
> 
> And here's a diagram of Strategy:
> 
> http://www.dofactory.com/Patterns/PatternStrategy.aspx
> 
> Could you plug the Commons Chain classes (existing or proposed) into an
> illustration (verbal will do) for me so I can better understand the debate?
> 
> Thanks,
> Erik
> 
> 
> Dakota Jack wrote:
> 
> >I inquired why the Template Method pattern is being used with Commons
> >Chain instead of Strategy, but never got an answer.  Given that the
> >choice seems so problematic, that surprised me.  Is that (no response)
> >because there is no answer, or because it is a closed shop of ideas in
> >open source, or because there is no time to consider such a stupid
> >idea, etc.?
> >
> >
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message