Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!novavax!weiner From: weiner@novavax.UUCP (Bob Weiner) Newsgroups: comp.object Subject: Re: Inheritance explained... finaly... Summary: Not even close to explaining inheritance. Message-ID: <1719@novavax.UUCP> Date: 6 Jan 90 00:15:11 GMT References: <1130005@gore.com> Organization: Nova University, Fort Lauderdale, FL Lines: 36 In-reply-to: jacob@gore.com's message of 5 Jan 90 09:11:18 GMT In article <1130005@gore.com> jacob@gore.com (Jacob Gore) writes: > IEEE Spectrum, January 1990. Cover topic: "Technology '90". Under the > major heading "Systems software", there is an article called > "Object-oriented programming a hit" by Ted G. Lewis ("Expert Opinion"). > Here's a passage from it: > > Perhaps the most powerful concept in object-oriented > programming systems is inheritance. Objects can be > created by inheriting the properties of other objects, > thus removing the need to write any code whatsoever! > Suppose, for example, a program is to process complex > numbers consisting of real and imaginary parts. In a > complex number, the real and imaginary parts behave like > real numbers, so all of the operations (+, -, /, *, > sqrt, sin, cos, etc.) can be inherited from the class of > objects called REAL, instead of having to be written in > code. This has major impact on programmer productivity. This passage when taken alone (since I have not read the article) indicates that one can operate on 'complex numbers' as if they were 'real's. Try again. I'm sure the intent was to say that the 'real' operators may be used to build the complex operators, which is true. However once again the 'is-a' relation that is so important in many uses of inheritance has been ignored. It's a simple test that can be applied with only a moment's thought: Is a 'complex number' a type of 'real' number? No. It may be composed of a pair of real numbers and hence OO techniques for composition should be applied rather than those for inheritance. With all the good examples in the world of 'is-a' and 'composed-of' relations, why do people continually confuse the relations when programming? -- Bob Weiner, Motorola, Inc., USENET: ...!gatech!uflorida!novavax!weiner (407) 364-2087