3 ms·
I think he's right. If you end up thinking about non-trivial tree of classes, like shape-circle-oval, square-rect-polygon, triangle - you're doing it wrong! I
by ilyak 17y ago
I think he's right.
If you end up thinking about non-trivial tree of classes, like shape-circle-oval, square-rect-polygon, triangle - you're doing it wrong!
I don't know why, but it just does never seem to work. You can generalize it to a polygon, tho, and it would work.
What you really want from subclassing is interfaces (Set and List come to mind immediately) and civilized monkey-patching (you have a class, you want some of its behavior changed, so you override a method or two).
- joe_the_user 17y agoExcellent point, It's worth having Objects represent a particular hierarchy of characteristics that you would like to concentrate on and to allow other characteristics be represent by containment and list objects. I've programming in c++ w/ QT lately and it seems like it actually has most of what I've gotten used to in Ruby if I represent a significant amount of the data structures with hash and list templates rather than trying to represent everything with the class construct.