struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Graham" <dgraham1...@hotmail.com>
Subject Re: [Best Practices] Use of Map as ValueObject
Date Thu, 31 Oct 2002 21:46:38 GMT
Never pass the ResultSet out of the DAO.  This holds the db connection 
longer than is necessary as well as exposing the DAO implementation to the 
business logic (which defeats the whole purpose of the dao).  The dao passes 
a value bean back to the business logic.

I wouldn't use maps either because then your system becomes hard to maintain 
with questions like, "What does this Map represent?" and "What values do I 
have access to in this Map?".  Using value beans makes your system 
symantically clear.

David



>From: "Jerry Jalenak" <Jerry.Jalenak@LABONE.com>
>Reply-To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
>To: "'struts-user@jakarta.apache.org'" <struts-user@jakarta.apache.org>
>Subject: [Best Practices] Use of Map as ValueObject
>Date: Thu, 31 Oct 2002 15:12:22 -0600
>
>During a conversation with one of my programmers today, I mentioned that I
>had begun using Maps instead of a ValueObject bean to pass basic data
>elements between my Action, Business Logic, and DAO levels.  Coming back up
>from a DAO I've tended to pass the ResultSet (or void) back to my Business
>Logic.  In my Business Logic I instantiate a bean, populate it with the 
>data
>from the ResultSet, and pass it back to my Action.  The Action can then
>store it in the request/session (as needed), and then forward to the
>appropriate JSP.  I was asked what the advantages were to this approach, 
>and
>aside from not having to write ValueObject beans, I can't come up with a
>good answer.  My question to the list then is this - Is this an appropriate
>approach to passing simple data elements between application layers?  Is it
>better to write ValueObject beans?  If so, why?
>
>I'm open to comments on this, as we are trying to standardize on how we 
>pass
>data around....
>
>TIA,
>
>Jerry Jalenak
>Web Publishing
>LabOne, Inc.
>10101 Renner Blvd.
>Lenexa, KS  66219
>(913) 577-1496
>jerry.jalenak@labone.com
>
>
>This transmission (and any information attached to it) may be confidential 
>and is intended solely for the use of the individual or entity to which it 
>is addressed. If you are not the intended recipient or the person 
>responsible for delivering the transmission to the intended recipient, be 
>advised that you have received this transmission in error and that any use, 
>dissemination, forwarding, printing, or copying of this information is 
>strictly prohibited. If you have received this transmission in error, 
>please immediately notify LabOne at (800)388-4675.
>
>
>
>--
>To unsubscribe, e-mail:   
><mailto:struts-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: 
><mailto:struts-user-help@jakarta.apache.org>


_________________________________________________________________
Surf the Web without missing calls! Get MSN Broadband.  
http://resourcecenter.msn.com/access/plans/freeactivation.asp


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


Mime
View raw message