struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mike <m...@michaelmcgrady.com>
Subject Re: Theoretical debate
Date Fri, 18 Jun 2004 14:31:20 GMT
At 07:18 AM 6/18/2004, Bill Schneider wrote:

>Form beans can be thought of as a special case of DTOs: they are the 
>argument the client (web browser) passes to the remote method call (HTTP 
>POST).  So passing form beans directly to business logic is _almost_ 
>reasonable, putting the dependency issue aside for now (form beans have to 
>extend ActionForm).
>
>The difference is, form beans are a model of the /user input/, and since 
>there may be invalid inputs (for example: "asdfjkjkd" in a field that's 
>supposed to be numeric) form bean fields often need to be Strings when the 
>corresponding field in a "real" DTO would be a Date or Integer.
>
>To deal with this, I've used a tool called XSnapshot (just released to 
>SourceForge: http://xsnapshot.sourceforge.net) to generate form beans and 
>other DTOs from XDoclet tags in a POJO data model.  That way you get 
>_both_ real DTOs and Form Beans without writing all the classes by hand, 
>and you can copy between DTOs and form beans with BeanUtils.copyProperties.
>
>-- Bill
>--
>Bill Schneider
>Chief Architect

I don't think we should be thinking of action forms as DTOs.  DTOs or VOs 
have a special use and a special problem that they are meant to 
solve.  Action forms are related to an entirely different set of issues 
about data farming.  I don't think we can put the dependency issue 
aside.  That is really the whole point of frameworks like Struts.  If you 
can put the dependency issues aside, you probably don't need Struts.  If 
you don't need a hammer, that is not a critique of a hammer.  Likewise, 
Struts has an objective and, with clear areas that could be improved, does 
that really well.  There is a good reason that Struts is so 
successful.  Craig is a sweetheart, but that is not the reason for the 
success of Struts.

I think that a lot of the problems people have with repetitive programming 
is not the fault of the framework but the failure to use coding techniques 
that are readily available, such as dynamic proxies.

Michael



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


Mime
View raw message