B
big vinny
Hi I've been writing some serializing functions to load/store classes into
db tables. There appears to be 2 ways of doing it,
1) iterative, derived classes store their parent's data before storing
themselves, including the pkey of their parents in their own tables.
This results in each level of inheritence having a table solely for data
specific to that inheritence level.
2) wholesale dump of class into one table. this means every level of
inheritence must take care of all data
that its available to it. Seems straights forward, however can get
complicated with classes with lots of data,
and not needing to rewrite the same code for each level of inheritence just
doesn't seem nice.
What are the common ways its being done my the ummm experts?
Right now I'm going with 1, a side effect appears to be that the tables
generated are somewhat normalised, 2nf at least, 3nf in most cases.
db tables. There appears to be 2 ways of doing it,
1) iterative, derived classes store their parent's data before storing
themselves, including the pkey of their parents in their own tables.
This results in each level of inheritence having a table solely for data
specific to that inheritence level.
2) wholesale dump of class into one table. this means every level of
inheritence must take care of all data
that its available to it. Seems straights forward, however can get
complicated with classes with lots of data,
and not needing to rewrite the same code for each level of inheritence just
doesn't seem nice.
What are the common ways its being done my the ummm experts?
Right now I'm going with 1, a side effect appears to be that the tables
generated are somewhat normalised, 2nf at least, 3nf in most cases.