S
Steve Barnett
I have a database with two tables "Structure" and "Data". The Data table
contains the data for my application, so no problem there. The Structure
table effectively puts some organisation to the Data table. It contains a
"tree structure" of records linked by parent/child/sibling pointers plus the
key of the data record that it refers to. It is possible for the same data
record to be referred to in more than one place in the structure.
Now, when I translate this to objects, I get a Data object with the data in
it and a Structure object with the structure in it. However, in order to
render a structure object on screen, it requires some of the data from the
data object.
So, should "Structure" be derived from the Data object, or should the
Structure object contain a Data object? My initial reaction is that
Structure inherits Data, but thinking about it, the Structure object
requires very little of the Data object in order to render it, so inheriting
a full Data object seems like way too much of an overhead. I could create a
Structure object that contains some of the data from the data table, but
that feels too much like data duplication.
Anyone got any opinions (As you can tell from the description, I'm very much
a beginner at this stuff).
Thanks
Steve
contains the data for my application, so no problem there. The Structure
table effectively puts some organisation to the Data table. It contains a
"tree structure" of records linked by parent/child/sibling pointers plus the
key of the data record that it refers to. It is possible for the same data
record to be referred to in more than one place in the structure.
Now, when I translate this to objects, I get a Data object with the data in
it and a Structure object with the structure in it. However, in order to
render a structure object on screen, it requires some of the data from the
data object.
So, should "Structure" be derived from the Data object, or should the
Structure object contain a Data object? My initial reaction is that
Structure inherits Data, but thinking about it, the Structure object
requires very little of the Data object in order to render it, so inheriting
a full Data object seems like way too much of an overhead. I could create a
Structure object that contains some of the data from the data table, but
that feels too much like data duplication.
Anyone got any opinions (As you can tell from the description, I'm very much
a beginner at this stuff).
Thanks
Steve