I have been burned so many times by using subclassing/inheritance, that now anything other than simple interface implementation or implementing an abstract class is almost never used.
Looks like this whole idea of designing class hierarchies is not very useful, other than as far as refactoring goes. With the addition of the "you ain't gonna need it" principle, that means that if you can make the code clearer/more compact, then use the inheritance, otherwise don't bother.
Also, I find myself using inheritance not at the design stage, but at the refactoring stage. Code it up first, extract superclasses later if that makes sense.
So, to me this question is more of a "how many angels can dance on the head of a pin?" thing.
no subject
Date: 2011-01-24 10:57 pm (UTC)Looks like this whole idea of designing class hierarchies is not very useful, other than as far as refactoring goes. With the addition of the "you ain't gonna need it" principle, that means that if you can make the code clearer/more compact, then use the inheritance, otherwise don't bother.
Also, I find myself using inheritance not at the design stage, but at the refactoring stage. Code it up first, extract superclasses later if that makes sense.
So, to me this question is more of a "how many angels can dance on the head of a pin?" thing.