ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brandon Goodin <brandon.goo...@gmail.com>
Subject Re: Advantage of Map over Bean as a parameterObject?
Date Tue, 05 Jul 2005 15:01:44 GMT
okay, since everyone else is chiming in... I'll add to Tim's point.

Even if you are using your returned data in a read only format you may
also want to perform calculations on the results. With maps you cannot
predict what type will be returned by the driver. This results in
something like a BigInteger being returned where you expected an
Integer. Granted, you can cure this on the resultmap. But, if you are
willing to do that... why not simply make it a bean :)

Brandon

On 7/5/05, Chen, Tim <Tim.Chen@nielsenmedia.com> wrote:
>  
> A sports car the transforms into a bicycle? I want one of those. Women love
> transformers. 
>   
> Advantage of maps over beans is that its a simple way to get data that you
> dont care about manipulating or handling. 
> For example displayed tables that are not editable. 
> If I wanted to see a list of all flights for an airline for example it is
> simple and easy to hold them as a map keyed by cities and values of
> collections of destinations. 
> From there you can hold the values of destinations as a hashmap of maybe: 
>   
> City:SomeCity 
> Price:SomePrice 
> DepartTime:SomeTime 
> ArrivalTime:SomeOtherTime 
>   
> Which is fine if you are doing it solely for display purposes but if you are
> thinking of using it for updating/inserting as well. 
> A javabean allows you to hold any business rules, type cast, validate
> values, and (very important imo) allows another developer to not have to
> search thru lines of code to figure out what exactly you are holding in a
> map which can severly cut down on development/maintanence time. 
>   
> Just my 2 cents (now I have to wait that much longer to get my transforming
> sports car/bike) 
>   
>  ________________________________
>  
> From: Clinton Begin [mailto:clinton.begin@gmail.com] 
> Sent: Sunday, July 03, 2005 11:08 AM
> To: user-java@ibatis.apache.org
> Subject: Re: Advantage of Map over Bean as a parameterObject?
> 
>  
> 
> >> You don't have to change or maintain it.
> 
> That's an exaggeration.  All software requires maintenance, perhaps Maps
> require less...but the end result is less as well.
> 
> A bicycle requires less maintenance than a sports car too....but I know what
> I'm driving home from work.  ;-)
> 
> Cheers,
> Clinton
> 
> 
> 
> 
> 
>  
> On 7/3/05, netsql <netsql@roomity.com> wrote: 
> > 
> > >
> > > 1) You don't have to write a JavaBean class.
> > >
> > >
> > 
> > ;-)
> > 
> > 2nd one:
> > 2)You don't have to change or maintain it.
> > As project evolves and front end and back end evolve... there is no 
> > maitanance or CRUFT or duplication.
> > 
> > I used to do beans for many years. Then I started w/ Groovy, CoR, C#,
> > Flash, etc... They all are Map and Collections based. Even when I make a
> > JTable it needs a collection. I my case, I have no needs for a bean. All 
> > my API only takes Map args and sometimes return Lists. (A silly little
> > varargs). After all how often do you get a class cast exception!
> > 
> > .V
> > 
> > 
> 
>

Mime
View raw message