struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Graham" <dgraham1...@hotmail.com>
Subject Re: Why not just use Request.getParameterMap() ?
Date Fri, 23 May 2003 13:45:20 GMT
>Personally, I've found that once you've started to use a business facade, 
>there's a good case of using a data-entry facade object to go with it. So, 
>I define a business interface to represent a facade's data-transfer (or 
>"helper") object. I then implement that interface as an ActionForm. This 
>way you can pass the ActionForm directly to the facade (under its 
>interface). For unit tests, I write the tests against the helper interface, 
>but use the ActionForm implementation.

How do you deal with the form properties being Strings and your business 
objects using more appropriate data types like int?  Do you make a 
conversion somewhere?

David


>So, for the price of a few extra accessors, you can safely eliminate 
>duplication and eliminate dependency (Beck's Golden Rule).
>
>HTH, Ted.
>
>
>Mike Whittaker wrote:
>>>There are some decent designs to keep down the amount of duplicate 
>>>objects
>>>you need.
>>>
>>>1) You can place you model objects into your form and then use nested
>>>properties (form.model.property) to set/get them.  It works well for 
>>>forms
>>>(though probably wouldn't work very nicely for URL parameters).  That way
>>>you action class can just pull the fully created model object out of the
>>>form and pass it off to the business layer.
>>
>>
>>But the form is supposed to represent user input alone.
>>If you ship it to Model layer then change it (eg sql escapeing)...
>>Or is this only applicable before validation, after it can't possibly get
>>back to the view??
>>But what about session forms?
>>
>>
>>>2) Have you business layer expect interfaces (instead of objects)
>>>which have
>>>no presentation ties.  Have you ActionForm implement that interface.  
>>>Then
>>>passing your action form to the business layer isn't so bad.  You 
>>>business
>>>layer has no clue that there are presentation related functionality in 
>>>the
>>>model interface coming back to it.
>>>
>>
>>Then you have to have an interface for virtually every form.  More
>>duplication.
>>What if you have (more or less) just one form for your entire app?  Then 
>>you
>>can have one interface.  Still doesn't answer the concerns with 1) above
>>though.
>>
>>--
>>Mike W.
>
>
>--
>Ted Husted,
>Struts in Action <http://husted.com/struts/book.html>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail


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


Mime
View raw message