Newsgroups: comp.object,comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!udel!gatech!howland.reston.ans.net!spool.mu.edu!torn!nott!cunews!tina.mrco.carleton.ca!knight
From: knight@mrco.carleton.ca (Alan Knight)
Subject: Re: How many parents?
X-Nntp-Posting-Host: tina.mrco.carleton.ca
Message-ID: <knight.797884178@tina.mrco.carleton.ca>
Sender: news@cunews.carleton.ca (News Administrator)
Reply-To: knight@mrco.carleton.ca (Alan Knight)
Organization: The Object People
References: <36@template.win-uk.net> <3l9acq$dlg@news.cc.utah.edu> <1995Apr4.042612.18954@rcmcon.com> <3m59u3$bpg@ionews.io.org> <1995Apr8.163310.1865@rcmcon.com> <knight.797550489@tina.mrco.carleton.ca> <patrick_d_logan.272.0007E90F@ccm.jf.intel.com>
Date: Fri, 14 Apr 1995 18:29:38 GMT
Lines: 52
Xref: glinda.oz.cs.cmu.edu comp.object:29616 comp.lang.smalltalk:22783

In <patrick_d_logan.272.0007E90F@ccm.jf.intel.com> patrick_d_logan@ccm.jf.intel.com (Patrick D. Logan) writes:

>In article <knight.797550489@tina.mrco.carleton.ca> knight@mrco.carleton.ca (Alan Knight) writes:

>>People making blind comparisons between languages with very different
>>mechanisms often leads to confusion. This is particularly true of
>>something like MI. MI, as Robert Margin suggests it should be used in
>>C++ is more like providing type definitions than it is like the
>>code-sharing inheritance of Smalltalk. What Robert means by an
>>abstract class is not all that close to what Smalltalk calls an
>>abstract class. Confusing these concepts often results in misleading
>>comparisons.

>I am not sure I understand or agree with this statement.

>* Yes, there is no MI in Smalltalk (except for a few experiments I guess)

>* Yes, it is possible to use Smalltalk's message passing to "subscribe to 
>protocols" in place of C++'s MI to "inherit protocols".

>* Yet, I still tend to create abstract classes in Smalltalk and use them as 
>interface descriptions. I primarily use single inheritance of interfaces, with 
>rare use of what I called above "subscribing to protocols" via implementing 
>the expected set of methods.

Do you really? I almost never create completely abstract classes, that
is classes in which there are no instance variables and every method
is subclassREsponsibility. If I understand Robert Martin's preferred
approach correctly, he suggests that this is the ideal, and that these
pure abstract classes are used to define protocols which the concrete
classes inherit from. I believe he even suggested (in the interests of
information hiding) never to inherit from classes with instance
variables.

While this sounds emminently sensible as a method of decoupling
interfaces in C++, it has very little relation to the uses of
inheritance in Smalltalk, where one inherits primarily to share code.
In Smalltalk, dynamic typing already completely decouples interfaces
(at least as far as the programming language is concerned, clearly the
code may have dependencies). Smalltalk abstract classes also act as
partial interface descriptions, but they almost always have some code and
they may well have data.

Using Smalltalk-like inheritance with MI results in something more
like CLOS mixins (inheriting little bits of code) than what Mr. Martin
suggests (inheriting pure interface).

-- 
 Alan Knight                | The Object People
 knight@acm.org             | Smalltalk and OO Training and Consulting
 alan_knight@mindlink.bc.ca | 509-885 Meadowlands Dr.
 +1 613 225 8812            | Ottawa, Canada, K2C 3N2
