Path: utzoo!attcan!uunet!wuarchive!usc!ucla-cs!rutgers!mcnc!decvax.dec.com!bacchus.pa.dec.com!decatl!nonvax.alf.dec.com!adams From: adams@nonvax.alf.dec.com (Vernon Adams) Newsgroups: comp.lang.c++ Subject: Re: Smalltalk-like classes Message-ID: <1990Sep14.082823@nonvax.alf.dec.com> Date: 14 Sep 90 12:28:23 GMT References: <1990Sep13.011214.24799@cs.columbia.edu> <57379@microsoft.UUCP> Sender: news@decatl.dec.com (USENET News System) Reply-To: adams@nonvax.alf.dec.com (Vernon Adams) Organization: Digital Equipment Corporation Lines: 59 In article <1990Sep13.011214.24799@cs.columbia.edu>, kearns@cs.columbia.edu (Steve Kearns) writes: |> One of the biggest pains of smalltalk-like classes is that |> to understand one class may require scanning four or five classes |> (the inherited ones). This is neccessary to find out all the functions |> and variables that make up a derived object. |> |> This goes against one of the fundamental principles of object oriented |> programming: a class encapsulates all the functions and data that comprise |> an object. |> |> One solution is to copy the inherited information into the derived |> class, prefixing the inherited items with the keyword "inherited". |> This is not really a viable solution, however, since an edit of the |> super class might require edits in all derived classes. |> |> A better solution seems to be the following: soon we will all be using |> nifty class browsers. I would suggest that these class browsers |> automatically copy the inherited items (and their documentation, |> please) into the subclass with the inherited keyword, or else in |> italics, or prefixed with the superclass name. |> |> The benefit of all this, I repeat, is that one would have to look at |> exactly 1 class to understand 1 class. Steve, You seem to be missing one of the great boons of object-oriented systems: inheritance. If you COPY stuff from the parent classes to the child classes you lose the inheritance capabilities. Your code is no more mantainable than heavily "included" code from traditional languages. One point of inheritance is that if I do discover a bug in some code and make the fix to that code, the fix will propagate to all the children who inherit the code. However, not to flame, your complaint about limited visibility within a heavily decomposed class hierarchy is a very legimate one. And it has already been addressed in some class browsers. Instead of copying code (or even doc) from the parents of a class, some browsers provide a class flattening mechanism which allows the user to view either only those extensions defined within this class or to view all the inherited characteristics (including mehtods) of a class. By using the second option one can see everything about a particular class and where it was inherited from. Take a look at Object/1 for an example. Hope this helps answer your complaint with smalltalk-like classes. Vernon