B
Beringer
Hello,
This may seem long an drawn out, but that is probably because I am
approaching my design incorrectly.
It is pretty easy to model an object with a database, simply create a table
for it and place all its attributes in the table.
What if you have a more complex object, say it contains a variable number of
other multiple objects?
As an example, a bowl of fruit as an object. Can contain any number of
apples, oranges and bananas depending on what the user placed in it.
Now there can be a seperate table for all the fruits of the world, but how
do you model a particular LIST of fruit as being in the bowl? Different
bowls can have different types and amounts of fruit.
One way I have thought of solving this doesn't seem very robust. That is,
every bowl has a key and then simply search every fruit table for that key.
I don't like this idea because it depends on table names and what if you
add, remove or change a table name? That means a coding change. Also there
are many different kinds of fruit, you would have to search every one to
make sure the bowl was filled correctly.
Thank you in advance,
Eric
This may seem long an drawn out, but that is probably because I am
approaching my design incorrectly.
It is pretty easy to model an object with a database, simply create a table
for it and place all its attributes in the table.
What if you have a more complex object, say it contains a variable number of
other multiple objects?
As an example, a bowl of fruit as an object. Can contain any number of
apples, oranges and bananas depending on what the user placed in it.
Now there can be a seperate table for all the fruits of the world, but how
do you model a particular LIST of fruit as being in the bowl? Different
bowls can have different types and amounts of fruit.
One way I have thought of solving this doesn't seem very robust. That is,
every bowl has a key and then simply search every fruit table for that key.
I don't like this idea because it depends on table names and what if you
add, remove or change a table name? That means a coding change. Also there
are many different kinds of fruit, you would have to search every one to
make sure the bowl was filled correctly.
Thank you in advance,
Eric