Tony said:
Hi,
I'm writing an application for a restaurant. Part of the application is
the table scheduling, but I'm not sure how to store the available
reservations. If I prefill these for the next year, it is going to take
up a lot of space in the database.
It depends a bit on how you represent the information in the program and
how you want to manipulate it.
1:
with a database where you only have search results in program memory you
just represent it as a reservation table with the information date,
time, timespan, table_num, customer_name etc
you do simple seraches which returns some rows which you add in an
ArrayList and display. You could search for all reservations on a
certain date or on a date for table num x, etc
2:
if you want to hold it in memory (todays and tomorrows reservations) and
perform in-memory searches you need to create a memory representation
that can perform such operations quickly and easily, ex.
- have an object representing a reservation. it contains the table
number, the date/time and timespan (the timespan depends on the policy
of the restaurant as some restaurants only have one reservation for the
table for the whole evening, while others have several)
- then you have two indexes: date and table which will hold a reference
to the reservation
You would of course store it aswell, but for that you only need to
serialise it to either a file format, binary or xml or you could use
javaspace, bbdb, or a sql or oo db.
/tom