struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Germuska <...@Germuska.com>
Subject Re: [Proposal] ActionFactory refactoring
Date Fri, 02 Jan 2004 22:30:20 GMT
At 10:44 AM -1000 1/2/04, Don Brown wrote:
>What if we extracted the creation of Actions and ActionForms (including
>DynaActionForms) into an ActionFactory, overridable by the user?

In general, I'm in favor.   I disagree with Vic's assertion, 
paraphrased "factories are too complicated; it's good enough to 
directly call the constructor" -- certainly that is appropriate for 
some classes, but by centralizing expertise for creating instances 
within a single class, you have a lot more flexibility to make an 
across-the-board change to what exactly which objects are created. 
(Something to which Martin alluded while I was composing this 
message.)

I won't elaborate too much at the risk of hijacking, but I wonder if 
we could also use this as an easy step towards an API whereby an 
Action could request an "output form" instance for pre-population. 
(That is, the form bean which would back an html:form block in the 
destination view, as opposed to the "input form" which  encapsulates 
the request parameters.)

This was one of the motivations for adding a view controller, which 
we talked about in the fall, and which  I looked at doing for a 
little bit.  A full-fledged view controller raised a lot of questions 
which made me inclined to wait for struts-chain, but a simple 
mechanism which boils down (for most users) to a method in Action or 
ActionMapping like "getOutputForm(String)" might be a nice 
compromise.  Personally, if I could easily get an output form in an 
Action, I could live a while longer without a separate class to 
encapsulate my view stuff.  The mechanism we use now is a horrible 
hack.

OK, I'm afraid I've already elaborated too much...  Back to the 
specifics, I'm a little uneasy about the method to explicitly get a 
DynaActionForm.  Otherwise, I think it's likely to be helpful, and 
likely to be a low-impact change.

Joe
-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
  "We want beef in dessert if we can get it there."
   -- Betty Hogan, Director of New Product Development, National 
Cattlemen's Beef Association


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


Mime
View raw message