ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chen, Tim" <Tim.C...@NielsenMedia.com>
Subject RE: Is this overkill?
Date Tue, 01 Mar 2005 16:53:42 GMT
Or if its just for display just return it as an XML string or Hashmap
and cache as such.
Simple and no need for any objects at all.
And uses iBatis' very cool return as XML capabilities :) 

-----Original Message-----
From: Paul Barry [mailto:paul.barry@nyu.edu] 
Sent: Saturday, February 26, 2005 9:29 PM
To: ibatis-user-java@incubator.apache.org
Subject: Re: Is this overkill?

Using the object isn't any more effort than using a String and it also
provides more flexibility.  If you find that your WeekDay object ends up
with more properties later, no need to modify the service interface.

public class WeekDay {
     private String name;
     //Getters/Setters...
}

public interface ShopOpenService {
   public List<WeekDay> getDaysOpen();
}

Tim Christopher wrote:
> Hi,
> 
> What would you suggest I do if I needed to print a list of the days of

> the week that the shop is open, ie. Monday, Wednesday, Saturday.  This

> list is subject to change by the user (admin) via an online form and 
> so the details will be stored in a database.
> 
> To create a WeekDay object and a ShopOpenServices file, which would 
> only contain a query to "select * from tblDaysOpen" seems overkill to 
> me...  Especially as the week day isn't really what I would have 
> considered to be an object in my design - each one just contains a 
> string!
> 
> Can anyone suggest a better approach to this, or is this the way 
> everyone else would do it?
> 
> Tim Christopher


Mime
View raw message