And Rick already pointed out reasons it can be a bad idea to pass a map
to a class that extracts the data because you end up with confusion
about fields and lose type checking.

So accepted best practice in this case is to have a method in your
action that transfers the data from the form to the VO, then pass the VO
off?

-Brady

> I would say no, it's no more acceptable (acceptable being a relative term
> of course!).
> 
> An EmployeeVO, presuming that is an object passed form the control layer
> to the model layer, still needs to know about something in the view layer,
> the ActionForm.  Hence, it's not really any better.
> 
> In reply to Rick's original post, I echo the thoughts of others that
> passing an ActionForm out of an Action to a delegate is generally a bad
> idea, and certainly is not in keeping with the original intent of an
> ActionForm, nor in what are generally seen as the best practices of the
> time.
> 
> Passing the request is kind of a separate question, but just as
> undesirable in my opinion because it ties your model to the presentation
> mechanism.  What if someone comes along and wants to take your web-based
> application and create a Swing front-end for it?
> 
> Another good reason to not pass request around is that your business
> delegates become harder to unit test because now you have to deal with
> mock request objects, or maybe even a whole mock servlet setup (I've seen
> session passed to business delegates too).
> 
> I believe Rick knows when he is breaking the "rules" and consciously
> chooses to do so :)  That's acceptable because he understands the
> consequences and can intelligently make the decision.  It's important
> though that new developers understand not only what things are frowned
> upon, but also WHY they are frowned upon.  I can speak from experience
> when I say I haven't always followed best practices, sometimes because the
> situation warranted, but also sometimes because I didn't understand the
> reasoning behind the practices and hence wasn't convinced to follow them. 
> Best practices are best practices because people tend to agree they have
> more benefit than other approaches in most cases, and that is the case
> here.
> 
-- 
Brady Hegberg <[EMAIL PROTECTED]>


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

Reply via email to