[Nitro] nice post

Richard Hundt richard at protea-systems.com
Tue Aug 1 20:15:17 EDT 2006


Hi George,

I've got a couple of question regarding Og.

I've written something very similar in Perl called Oryx (it's up on 
CPAN). Oryx ended up doing what Og does with automatic schema creation 
and evolution (admittedly Perl is more verbose, though). In the process 
I also ran into inheritance and abstract classes and what these concepts 
could mean to an ORM system. So when reading through some docs on Og, I 
found some mention of what looked like a unsolved inheritance issues. 
What happens when persistent classes inherit from one another?

Basically there are 3 ways of modeling this (which I'm sure you're aware 
of, but it's hard to ask the question without scoping it out).

The simplest is to put all classes in the inheritance chain in a single 
table (which is what Tangram does). Another way is to duplicate the 
table for the subclass with the same columns as the super class and then 
add columns to this new table for the new attributes defined in the 
subclass. However, the most natural for me was to create a new table 
with only the newly added attributes for the subclass and join on the 
table of the superclass. Some tricks are needed to keep track of which 
columns should be delegated to the superclass for inserts, updates and 
deletes. This isn't too hard though.

So, I guess my questions regarding inheritance are: which model does Og 
use, and is inheritance still considered "dangerous" and not recommended 
(because stuff ends up going into the wrong tables)?

Cheers,
Richard





George Moschovitis wrote:
> have a look at this nice post:
>
> http://nitroproject.org/blog/articles/7
>
> as always, your comments are welcome!
>
> -g.
>



More information about the Nitro-general mailing list