This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Artima Forums.
Message:
Classification issues
Posted by Alex Bunardzic on 22 Oct 1998, 10:19 AM
I am a biologist by education, and a software developer by choice. The concept of defining inheritance by classifying the components that comprise the problem domain has always been very familiar to me, but I can appreciate that it can be a stumbling block for someone who's not formally trained in that area. In this respect, I agree with the direction Bill's article is pointing to: if you're muddled about the correct classification, use the damn composition! Nothing good is ever going to come out of a muddled and short-circuited inheritance schema. So, definitely, don't go for inheritance in order to achieve some special effect (like, polymorphism). Things like late binding and polymorphism should emerge only as an afterthought, should be the result, not the motive for classifying things under the inheritance umbrella. However, I also agree with the criticism offered to Bill: just because the bulk of people are not yet properly trained in OO design, doesn't mean that those design principles are invalid. True, composition has the merit of being based on common-sense, while inheritance requires transending the common-sense reasoning; but that doesn't make inheritance in any way inferior. I still think that developers should be encouraged to master the proper design methodologies. They should be taught to resist the temptation to take the path of least resistance. In saying this, must confess that I am a double-tongued liar, because I cheat in my OO design all the time. I take all the shortcuts (as God has intended) like there is no tomorrow. But at least I think I know the value and the merits of proper classification scheme. Alex
Replies:
|