in reply to OO design and persistence
Con: possibly wastes space, gets confusing if you have a largish number of subclasses. You should probably not use this if you want to represent "the ultimate base class" (Object/UNIVERSAL) in your database.
Pro: allows for larger inheritance-trees to be modeled in the database. Usually stores all attributes in exactly one place.
Con: makes efficient selecting on multiple attributes an "interesting" problem. Retrieving all attributes of an object is fairly expensive if the inheritance tree is large.
Pro: allows for larger inheritance-trees to be modeled in the database. Can do reasonably efficient selects on multiple attributes.
Con: not very efficient if you want to retrieve multiple subclasses. Stores inherited attributes in multiple tables (especially nasty for updates/inserts if you have large fields).
In summary: OO-relational mappings are not as clear-cut as they appear on first glance. Which system is best depends on your typical use. You always have to make trade-offs and in complicated systems you will want to write your own queries for certain actions that just don't map well.
update: note that some databases *cough* postgres *cough* support something called table-inheritance, which might be an interesting alternative solution.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: OO design and persistence
by qq (Hermit) on Dec 22, 2005 at 22:56 UTC |