----- Original Message -----
From: "Robert Taylor" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Monday, March 10, 2003 2:09 PM
Subject: RE: [Design Pattern]FormBean in Model Layer


> Is being tied to the DynaBean API that bad. Seems like it, along with the
> entire beanutils package, is a great tool. Why write custom DTO interfaces
> when you could simply leverage DynaActionForm or DynaValidatorActionForm
> which both implement the DynaBean interface. Then use the beanutils
package
> to "transform" the data? (I think its about 2 very powerful lines of
code).
> You avoid writing classes for each form. You just configure them (with
their
> initial state) in the struts-config file.

Not at all - I regularly use beanutils the way you outline above ;-)
Some people might want to define custom dto interfaces to provide their
domain services/delegates with a distinctive (and typed ?) contract for
getting parameters etc.

>
> This approach also reinforces the concept that ActionForms are view
> components and don't belong in the model.
> If the original intent was for ActionForms to be part of the model, then
> they would have been designed as interfaces, but Craig has voiced his
stance
> on this many times already, and is adamant about keeping the ActionForm in
> the view and out of the model.

I quite agree, which is why I suggested that ActionForms (or indeed
subclasses of dynaforms etc ) would *implement the domain* rather than the
domain implementing or knowing about struts or beanutils (which is bad and
one of the reasons actionforms are not an interface).
By doing it this way around I dont think that ActionForms are becoming part
of the model, quite the reverse, in fact we're telling struts a little bit
more about our domain model, which I don't think is altogether evil.

>
> I believe you would find a best practices strategy would be to use
> DynaXXXXForm where you can and either in the Action class or an
intermediate
> service layer, transform the data to the appropriate DTO objects which can
> then be passed to the the model/logic layer for processing.

I agree that seems like a good way to approach it :)


Cheers

Jin
>
> I would use the tools that are out there when you can...especially when
they
> are free.
>
>
> My 2 cents.
>
> robert
>
> > -----Original Message-----
> > From: Jin Bal [mailto:[EMAIL PROTECTED]
> > Sent: Monday, March 10, 2003 3:10 AM
> > To: Struts Users Mailing List
> > Subject: Re: [Design Pattern]FormBean in Model Layer
> >
> >
> > If you don't wnat to be tied to the DynaBean api either you could
> > defin your
> > own custom DTO interface that defines the data that your model layer
> > requires.
> >
> > then you could have your ActionForm implement your custom interface.
Then
> > you could just pass the action forms into the layer as the custom
> > interface.
> >
> > Your model layer wont know (or care) that your using an actionform all
it
> > cares about is the DTO interface.
> >
> > i.e your application deosn't know about struts but struts knows about
your
> > application
> >
> > might make things easier.
> >
> > HTH
> >
> > Jin
> > ----- Original Message -----
> > From: "harish krishnaswamy" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>;
"Puneet
> > Agarwal" <[EMAIL PROTECTED]>
> > Sent: Monday, March 10, 2003 1:34 AM
> > Subject: Re: [Design Pattern]FormBean in Model Layer
> >
> >
> > > Well, you would use the following form-bean
> > > definition.
> > >
> > > <form-bean name="sampleForm"
> > > type="xyz.domain.DynaActionFormSubClass">
> > >   <form-property name="lastName"
> > > type="java.lang.String">
> > >     <set-property>
> > >       <property>model-property</property>
> > >       <value>custLastName</value>
> > >     </set-property>
> > >   </form-property>
> > >   ...
> > >   ...
> > > </form-bean>
> > >
> > > Customize BeanUtils to copy the properties of
> > > DynaActionFormSubClass to a model-property-keyed map.
> > > pass this map to the model layer and have an adaptor
> > > in the model layer copy these porperties to the
> > > required model objects, again using BeanUtils.
> > >
> > > -Harish
> > >
> > > --- Puneet Agarwal <[EMAIL PROTECTED]> wrote:
> > > > Thanks for your views,
> > > > My basic intention is to avoid the headache of
> > > > copying the values from
> > > > FormBean to my Model layer.
> > > > and that since formbean keeps all the values in a
> > > > nice manner that can be
> > > > adaptive to any framework.
> > > >
> > > > Well this is a correct point that we should keep our
> > > > Model layer separate
> > > > from strutsish components.
> > > >
> > > > but Harsish's Idea sounds good, would be nice if
> > > > Harish could say something
> > > > more about his approach.
> > > >
> > > > Regards
> > > > Puneet Agarwal
> > > > ----------------------------->
> > > > "Struts"..."Action"..."Struts in Action"..."Action
> > > > in
> > > > Struts"...[possibly]"Action with Struts"...?
> > > > ----- Original Message -----
> > > > From: "harish krishnaswamy" <[EMAIL PROTECTED]>
> > > > To: "Struts Users Mailing List"
> > > > <[EMAIL PROTECTED]>
> > > > Sent: Sunday, March 09, 2003 3:09 AM
> > > > Subject: Re: [Design Pattern]FormBean in Model Layer
> > > >
> > > >
> > > > > In our project, we have designed our model facade
> > > > > objects to take in a map and let the facade copy
> > > > the
> > > > > map to the appropriate business objects using
> > > > > BeanUtils. We have customized the form-bean config
> > > > to
> > > > > map the form-bean properties to the model
> > > > properties.
> > > > > This way the model objects will be independent of
> > > > the
> > > > > view/controller.
> > > > >
> > > > > -Harish
> > > > >
> > > > >
> > > > > --- David Graham <[EMAIL PROTECTED]> wrote:
> > > > > > That is a terrible idea.  Form beans should
> > > > never
> > > > > > make it out of the
> > > > > > Struts/view layer.  You will tie your
> > > > application to
> > > > > > Struts and make it
> > > > > > impossible to reuse the logic in another
> > > > application
> > > > > > or even to stop using
> > > > > > Struts in the future.
> > > > > >
> > > > > > David
> > > > > >
> > > > > >
> > > > > >
> > > > > > >From: "Puneet Agarwal"
> > > > <[EMAIL PROTECTED]>
> > > > > > >Reply-To: "Puneet Agarwal"
> > > > > > <[EMAIL PROTECTED]>
> > > > > > >To: "Struts Users Mailing List"
> > > > > > <[EMAIL PROTECTED]>
> > > > > > >Subject: [Design Pattern]FormBean in Model
> > > > Layer
> > > > > > >Date: Sun, 9 Mar 2003 02:45:15 -0000
> > > > > > >
> > > > > > >We are in the stage of finalizing the design
> > > > > > pattern for our project.
> > > > > > >
> > > > > > >While discussing the design patterns with my
> > > > > > colleagues,
> > > > > > >somebody came with an idea to pass the FormBean
> > > > as
> > > > > > it is,
> > > > > > >to the Session Bean or sometimes even to the
> > > > Value
> > > > > > List handler Block
> > > > > > >Later I thought this can actually be a good
> > > > idea.
> > > > > > >
> > > > > > >I understand that this is against underlying
> > > > > > layered MVC pattern itself,
> > > > > > >but
> > > > > > >avoids a lot of headache. Can someone say what
> > > > > > could be other disadvantage
> > > > > > >of this.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >-------------------------->
> > > > > > >"Struts"..."Action"..."Struts in
> > > > Action"..."Action
> > > > > > in
> > > > > > >Struts"...[possibly]"Action with
> > > > Struts"..."Action
> > > > > > over Struts"...?
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > > >---------------------------------------------------------------------
> > > > > > >To unsubscribe, e-mail:
> > > > > > [EMAIL PROTECTED]
> > > > > > >For additional commands, e-mail:
> > > > > > [EMAIL PROTECTED]
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > > _________________________________________________________________
> > > > > > Protect your PC - get McAfee.com VirusScan
> > > > Online
> > > > > >
> > > > >
> > > >
> > > http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail:
> > > > > > [EMAIL PROTECTED]
> > > > > > For additional commands, e-mail:
> > > > > > [EMAIL PROTECTED]
> > > > > >
> > > > >
> > > > >
> > > > > __________________________________________________
> > > > > Do you Yahoo!?
> > > > > Yahoo! Tax Center - forms, calculators, tips, more
> > > > > http://taxes.yahoo.com/
> > > > >
> > > > >
> > > >
> > > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > > > [EMAIL PROTECTED]
> > > > > For additional commands, e-mail:
> > > > [EMAIL PROTECTED]
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > > [EMAIL PROTECTED]
> > > > For additional commands, e-mail:
> > > > [EMAIL PROTECTED]
> > > >
> > >
> > >
> > > __________________________________________________
> > > Do you Yahoo!?
> > > Yahoo! Tax Center - forms, calculators, tips, more
> > > http://taxes.yahoo.com/
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to