different design considerations for objects and tables

E

eddiec

hi everyone,

I am designing a pallet management system. Many items are placed onto one
pallet. The items are all unique and have distinct features. Now, as far as
application design is concerned the most intuitive way of handling this
would be to have a Pallet object that holds an array of Item objects, which
reflects the situation in real life. As far as database design is concerned,
however, it is easier for the item to 'know' which pallet it belongs to.
e.g. I would create a table for the individual items where one of the
fields is palletID.

So what do I do? It would be very confusing (I think) to have different
design approaches in the application and in the database schema.

TIA

eddiec :)
 
D

David Hilsee

eddiec said:
hi everyone,

I am designing a pallet management system. Many items are placed onto one
pallet. The items are all unique and have distinct features. Now, as far as
application design is concerned the most intuitive way of handling this
would be to have a Pallet object that holds an array of Item objects, which
reflects the situation in real life. As far as database design is concerned,
however, it is easier for the item to 'know' which pallet it belongs to.
e.g. I would create a table for the individual items where one of the
fields is palletID.

So what do I do? It would be very confusing (I think) to have different
design approaches in the application and in the database schema.

Since this is not really a question about C++, you may have more luck if you
post this in a different newsgroup, like comp.object, which covers general
OO design.
 
K

Kai-Uwe Bux

eddiec said:
hi everyone,

I am designing a pallet management system. Many items are placed onto one
pallet. The items are all unique and have distinct features. Now, as far
as application design is concerned the most intuitive way of handling this
would be to have a Pallet object that holds an array of Item objects,
which reflects the situation in real life. As far as database design is
concerned, however, it is easier for the item to 'know' which pallet it
belongs to.
e.g. I would create a table for the individual items where one of the
fields is palletID.

So what do I do? It would be very confusing (I think) to have different
design approaches in the application and in the database schema.

TIA

eddiec :)

Hi,


if you insist on realizing the datastructure within your objects, then this
is a question about OO design, which is of interest in this news group only
as far as C++ happens to support OO design.

However, in C++ there are other approaches to go about your particular
problem. You have two types of objects: pallets and items. Moreover, each
item is placed on one and only one pallet. Thus, abstractly, you have a map
assigning pallets to items:

f : Items --> Paletts.

Viewed from this angle, you might use a container (like
std::map<Item,Palett>) that implements this setup. However, you might also
want to iterate through all items on a given pallet. Thus, the container
should allow for efficient compuatation of preimages and offer an iterator
type for this purpose.

Solving this problem as a (possibly templated) container has the advantage
that you can change the implementation afterwards without affecting the
design of the classes Pallet and Item.


Best

Kai-Uwe Bux
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top