Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!sdd.hp.com!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!mucs!cs.man.ac.uk!mario From: mario@cs.man.ac.uk (Mario Wolczko) Newsgroups: comp.object Subject: Re: A Hard Problem for Static Type Systems Message-ID: <2499@m1.cs.man.ac.uk> Date: 7 May 91 17:02:08 GMT References: <554@eiffel.UUCP> <1991Apr26.203642.17387@leland.Stanford.EDU> Sender: news@cs.man.ac.uk Reply-To: mario@cs.man.ac.uk (Mario Wolczko) Distribution: comp Organization: Department of Computer Science, University of Manchester Lines: 37 In article , cimshop!davidm@uunet.UU.NET (David S. Masterson) writes: do most people use inheritance to build down from some underspecified level to something more specific to the problem at hand or do most people build up from some highly specific to something that can be more easily generalized to later problems? If you say either-or (depending on the circumstances), what are the circumstances that make you choose one over the other? I can only speak for myself. When trying to solve a specific problem I will try to identify aspects of that problem which are of a general nature, and which could be reused. (Example: in writing a compiler, I have developed classes to support directed acyclic graphs in a general way). In some cases, there will be parts of a class that are very specific to the problem at hand, and then I will try to factor the class into two classes -- an "abstract", reusable superclass, and a "concrete" subclass. Sometimes this factoring can be repeated, leading to a hierarchy of abstract classes, with concrete classes at the leaves. Sometimes the abstract class will already be there, and I just have to provide a concrete subclass, which is usually easy. (I do all my serious OO programming in Smalltalk, which has lots of abstract classes.) Occasionally I find a concrete class which does part of what I want, but perhaps something else which I don't, and then I try to split that class into abstract and concrete pieces, such that I can inherit from the abstract part to get what I want. (Splitting an existing class while remaining compatible can be very hard.) In any case I try to avoid having one concrete class inherit from another concrete class. Mario Wolczko ______ Dept. of Computer Science Internet: mario@cs.man.ac.uk /~ ~\ The University uucp: mcsun!ukc!man.cs!mario ( __ ) Manchester M13 9PL JANET: mario@uk.ac.man.cs `-': :`-' U.K. Tel: +44-61-275 6146 (FAX: 6236) ____; ;_____________the mushroom project___________________________________