From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,9a0ff0bffdf63657 X-Google-Attributes: gidfac41,public X-Google-Thread: f43e6,9a0ff0bffdf63657 X-Google-Attributes: gidf43e6,public X-Google-Thread: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public X-Google-Thread: 1108a1,9a0ff0bffdf63657 X-Google-Attributes: gid1108a1,public From: Loryn Jenkins Subject: Re: Which wastes more time? (Was Re: Software landmines (loops)) Date: 1998/09/11 Message-ID: <35F835C4.8E39162B@s054.aone.net.au>#1/1 X-Deja-AN: 389857797 Content-Transfer-Encoding: 7bit References: <35F56290.AB5491D9@s054.aone.net.au> <35F6C4BF.404D6A68@s054.aone.net.au> X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii X-Trace: news.mel.aone.net.au 905459194 15474 203.12.186.131 (10 Sep 1998 20:26:34 GMT) Organization: TekRite Pty Ltd Mime-Version: 1.0 Reply-To: loryn@acm.org NNTP-Posting-Date: 10 Sep 1998 20:26:34 GMT Newsgroups: comp.lang.eiffel,comp.object,comp.software-eng,comp.lang.ada Date: 1998-09-10T20:26:34+00:00 List-Id: > Suppose the report listed an employee's allowances. PERSON might > have a command called list_allowances. Whatever PERSON does in this > command, CAR_OWNER would extend it by adding a section for car > allowances. In this instance, you're modelling a disjoint set at particular instance in time through a generalisation relationship. (Last week, I would have called this "wrong". This week, I'll hedge a little more.) I'm sure this could work as code. But I don't like it from the point of view of classification theory. Inheritance is a generalisation mechanism, and direct subtypes represent disjoint sets. I would consider inheriting from PERSON into CAR_OWNER and NON_CAR_OWNER to be more valid than the above. However, this also is a non-optimal way of modelling this circumstance. We would probably be better off using the State Pattern (Gamma et al) (or flags) in order to obtain this functionality. > Does this suffice? If not, then perhaps my problem is that I don't > see where you're going by arguing that this is not a "real" > subtyping relationship. Could you explain that a bit more? Sure. Obviously, in Eiffel, every class is a distinct type. (But that doesn't need to be so in other languages.) In Chapter 24 of OOSCII, Meyer explores many types of inheritance: sub-typing and module extension being two of them. Where I'm arguing this would work reasonably well as "module extension" would be in the case that you come to a project requiring a CAR_OWNER type, and already have on hand a PERSON type. Now, CAR_OWNER contains all of the behaviour of PERSON, plus a bit more. Inheriting then from PERSON would be a way of extending the module in order to make use of it in the new application; even though you don't care about the PERSON abstraction for this application. That was the distinction I was referring to. Loryn Jenkins