Newsgroups: comp.lang.smalltalk,comp.lang.c++,comp.lang.java,comp.object
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!gatech!news.mathworks.com!zombie.ncsc.mil!newsgate.duke.edu!news.eff.org!sed.psrw.com!psinntp	!psinntp!psinntp!psinntp!merlin.hgc.edu!jcm
From: jcm@hgc.edu (James McKim)
Subject: Re: Dynamic vs. static type checking
Message-ID: <1996Jul19.171024.24207@merlin.hgc.edu>
Sender: usenet@merlin.hgc.edu (Action News Central)
Organization: The Hartford Graduate Center
References: <4saq9u$k3s@epx.cis.umn.edu> <31EA0843.E4@iitb. <rmartin-1807960939380001@vh1b-039.wwa.com>
Date: Fri, 19 Jul 1996 17:10:24 GMT
Lines: 68
Xref: glinda.oz.cs.cmu.edu comp.lang.smalltalk:41041 comp.lang.c++:201117 comp.lang.java:69777 comp.object:52353

In article <rmartin-1807960939380001@vh1b-039.wwa.com> rmartin@oma.com (Robert C. Martin) writes:
>In article <ROGOFF.96Jul17104432@sccm.Stanford.EDU>,
>rogoff@sccm.stanford.edu wrote:
>
>> rmartin@oma.com (Robert C. Martin) writes:
>>    Without MI this must either be implemented by manually copying the Subject
>>    code into the Objserved door (yuk), or by delegation.  In order to use
>>    delegation the interface of Subject must be copied into ObservedDoor by
>>    some means.  In Smalltalk it must be copied manually (yuk).  In languages
>>    like Java it can be a pure interface that is extended.  The ObjservedDoor
>>    must then contain an instance of a real Subject object.  All interfaces
>>    of Subject that were copied into ObservedDoor delegate to their 
>>    corresponding interfaces of the contained Subject object.
>> 
>> In a language with only single inheritance and genericity, you would 
>> presumably factor the "Observable" property into a generic package since 
>> it is clearly a mixin. In pseudo-Ada-95.
>> 
>> generic 
>>   type T is new Object with private;
>> package Observable_Mixin is
>>   type Observable_Object is new T with private;
>> 
>>   -- Observable_Object exported operations like Register, Notify ...
>>   ...
>> private
>>   type Observable_Object is new T with 
>>     record
>>     -- fields you wish to add, like Set_Of_Observers
>>     end record;
>> end Observable_Mixin;
>> 
>>    This is a pain in any language, and is addressed elegantly using MI.
>> 
>> Do you find what I wrote that awful? It is a bit more verbose than the MI 
>> solution, but no less elegant IMO. 
>
>Of course there are other elegant ways to accomplish what I want to do.
>My point was that MI provided an elegant solution; not that MI provided
>the *only* elegant solution. 
>
>MI is a useful tool.

I'm not sure the above is a faithful equivalent of what MI provides
in C++, Eiffel, CLOS, et al. I'm not sure it's _not_ either, so I'll
ask.

With the above scheme, do I get polymorphism through both "ancestors"?
That is, can I build a list of OBSERVABLE_OBJECTs and polymorphically
dispatch calls to Register. Same question with a list of DOORs and
feature Open.

>
>-- 
>Robert C. Martin    | Design Consulting   | Training courses offered:
>Object Mentor       | rmartin@oma.com     |   Object Oriented Design
>14619 N Somerset Cr | Tel: (847) 918-1004 |   C++
>Green Oaks IL 60048 | Fax: (847) 918-1023 | http://www.oma.com  
>
>"One of the great commandments of science is:
>    'Mistrust arguments from authority.'" -- Carl Sagan


-- 

*------------------------------------------------------------------------------*
Jim McKim  (860)-548-2458     Teachers affect eternity. They can never tell 
Internet:  jcm@hgc.edu        where their influence stops.
