You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Tim Christopher <ti...@gmail.com> on 2005/02/27 03:14:48 UTC
Is this overkill?
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
Re: Is this overkill?
Posted by Paul Barry <pa...@nyu.edu>.
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