the { buckblogs :here }: Concerns in ActiveRecord
This is annoying. I would love it if a language supported all aspects of OO. In C# this is braindead simple.
“…..Ruby does not support multiple-inheritance. Personally, I have mixed feelings about that, but the fact of the matter is, you can accomplish almost exactly the same thing using modules.
Consider this ActiveRecord scenario. In Basecamp, we allow files to be attached to both messages, and comments. One way to do this would be to have both messages and comments inherit from a common ancestor, via single-table inheritance. Alas, the two models (in our case) are different enough that STI is not a viable option here. ….”
Comments
Comment from Jeff
Date: 1/27/2007, 12:28 pm
I think what Jamis is talking about here is the challenge in providing an ORM on top of tables which are similar but not similar enough to use Rails’ built-in STI feature. So he’s using that example to explain how Ruby helps bridge the gap in his case.
Ruby is as much OO as C# is (even a little more so, actually). In C#, sharing a common implemenation is done through delegation or composition (since you can’t inherit from more than one concrete class). Modules in Ruby provide a simple way to reuse an implementation without repeating any code.
(Apologies if I misunderstood what you were saying…?)
Comment from Thomas
Date: 1/27/2007, 1:13 pm
I must have misunderstood Jamie’s post. Thanks for clearing that up. …….. I’d hate to start a rumor about Ruby OO ![]()
Write a comment