Wolfgang wrote in post #1000187:
> STI is a good approach, but my "subtables" have additional attributes
> and afaik this isn't supportet by STI, is it?
>
> For example:
>
> user << Base
>   id
>   firstname
>   lastname
>   address
> end
>
> employee << user
>  <all of the above and additionally:>
>   salary
> end

In the past I used a framework that supported other techniques besides
Single-Table Inheritance. There were actually two other options that
were called Horizontal and Vertical Inheritance. Of those options
Vertical Inheritance was the closest to what we think of as object
inheritance (as you described above), but was also the least efficient.

The issue is that both Horizontal and Vertical inheritance require
multiple queries to get to all the data you need, which causes
performance problems. Even with a framework that supported the other
techniques, using STI was strongly recommended. The performance costs of
either Horizontal or Vertical was simply too high. Inheritance doesn't
map well to RDBMS. The cost of the null fields in a single table that
contains all attributes for the entire inheritance hierarchy is
negligible compared to the other techniques.

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to