I sometimes read about huge inheritance trees. Like in the book [Refactoring]. Some of the big refactorings include teasing apart large inheritance trees that have gotten out of hand. However, I find myself using class composition a lot more than class inheritance. I rarely find myself with an inheritance tree higher than 2, which can hardly be called a tree at all. Some people call my style 'flat', but I consider my code elegant and modular.
What about you? How much inheritance do you use? When is it useful to have a big inheritance tree?
Oh, I'm not counting frameworks like QT. I understand the need for extensive inheritance there, because you can never predict what the user will need.


Reply With Quote

There's more than one solution to every problem. Every programmer develops his/her own style.

Bookmarks