Xref: utzoo comp.lang.c++:3317 comp.lang.eiffel:185 comp.lang.smalltalk:1070 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!cs.utexas.edu!uunet!kddlab!titcca!sragwa!wsgw!socslgw!riks From: riks@csl.sony.JUNET (Rik Smoody) Newsgroups: comp.lang.c++,comp.lang.eiffel,comp.lang.smalltalk Subject: Re: Use of inheritance for classification? Keywords: metrics, oop Message-ID: <10248@riks.csl.sony.JUNET> Date: 15 May 89 01:45:43 GMT References: <30582@apple.Apple.COM> Reply-To: riks@riks. (Rik Smoody) Followup-To: comp.lang.c++ Organization: Sony Computer Science Laboratories, Inc., Tokyo, Japan. Lines: 61 In article <30582@apple.Apple.COM> kmcentee@Apple.COM (Kevin McEntee) writes: >should take place only in the context of the is-a relationship. > > e.g. Every dog is a mammal. But not all dogs are frisbeeCatchers. Do I need a special sub-class? Most dogs who catch frisbees use their mouth. Do we need special code for each dog or class who is to learn that trick? How would the subclasses by abilities combine with the subclasses such as Collie, AustralianShepherd, Spotted, LongHaired, FinickyEater, MailManBiting, etc. Soon, I might have an inordinately large set of classes, with such taxonomic gems as Every BurglarBarkingFrisbeeFetchingBlackAndWhiteLongHairedOmnivorousAustralianShepherdDog is-a FrisbeeFetchingBlackAndWhiteLongHairedOmnivorousAustralianShepherdDog (only slightly more sightly if I don't make the artificial restriction to single-inheritance) > >This seems to imply that inheritance is first a classification scheme and >only second a code sharing mechanism. The hard part about code sharing is knowing when. That's true for objects which belong to classes, and for procedures which get called from different places with different arguments Fortran or C. There's a baby in that bath-water. Where does the "code" of tieShoeLaces get attached to the taxonomy of humans? (Oops... can't a monkey learn how to tie shoes? Two sparrows in a Disney cartoon?) Most of us do it the same way. A good candidate for code sharing. > >What are your thoughts on this? Can code sharing outside of the natural >taxonomy of the problem space happen gracefully? Don't blindly assume a natural taxonomy, even in nature. Many great minds have argued inconclusively on the natural taxonomy of biological systems. Since we in CS are not bound by such constraints as species development by evolution, it seems a long reach to assert that any one taxonomy is comprehensive. Taxonomizing (is that a word?) and Code Sharing are not equivalent. We all have a blood type. That's a taxonomy. Exposure to certain diseases is another taxonomy. Profession is another. People of almost any profession (not the oldest), who do not possess any of the forbidden risk factors, should all share the code and give blood now and then. "Most generalizations are pretty good" Rik Fischer Smoody Sony Computer Science Lab, Inc. 3-14-13 Higashigotanda, Shinagawa-ku Tokyo 141 Japan phone: (03)448-4380 E-mail: riks@csl.sony.jp or maybe: riks@csl.sony.co.jp -- Rik Fischer Smoody Sony Computer Science Lab, Inc., 3-14-13 Higashigotanda Shinagawa-ku, Tokyo 141 Japan (03)448-4380