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.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Xref: utzoo comp.object:486 comp.lang.ada:2988 Path: utzoo!attcan!uunet!mcsun!cernvax!chx400!ugun2b!cui!anders From: anders@cui.unige.ch (BJORNERSTEDT Anders) Newsgroups: comp.object,comp.lang.ada Subject: Re: Re^2: Integrating concurrent & O-O programming Message-ID: <481@cui.unige.ch> Date: 23 Nov 89 16:18:49 GMT References: <7062@hubcap.clemson.edu> <1667@osc.COM> <477@cui.unige.ch> Reply-To: anders@cuisun.unige.ch Organization: University of Geneva, Switzerland List-Id: In article <477@cui.unige.ch> oscar@cui.unige.ch (NIERSTRASZ Oscar) writes: >In object-oriented languages, there are (at least) *two* clients to >object classes: the clients of the object instances, and subclasses >that wish to inherit the code. If you view inheritance as purely a Another interface is the interface to other instances of the same class. Try implementing the class integer with a method add in Smalltalk without exposing your internal representation. You can actually distinguish four different interfaces: 1- The interface to self of the same class. No encapsulation wanted here :-) 2- The interface to self of some other (super)class. 3- The interface to some other instance of the same class. 4- The interface to some other instance of some other class. In the programming language PAL of the Avance prototype (see oopsla88) we made no distinction between 2 and 3 and had three kinds of operations. Public operations could be used by 1-4. Private operations could be used by 1-3. Hidden operations and instance variables could be used by 1. The concept of a "friend functions" in C++ is related to this and further subdivides 4. [I am not a c++ expert though so I may be wrong]. >2. the interface of the superclass to inheriting subclasses must be > specified as completely as the interface of an object to > its clients. >We would prefer solution 2, but unfortunately we don't know how to do this >very well, although we try sometimes to make do with natural language. Kind 2 operations give you exactly this. Kind 3 operations allow you to implement an "algebra" without exposing the internals of objects. If you have a distributed system then the distinction of kind 2 and 3 operations becomes important for another reason. Directly accessing non-local state may not be practical. Some people argue that inheritance is not useful or even "inconsistent" with distribution. Kind 2 operations at least makes inheritance "consistent" with distribution. Whether it is useful can be debated. Still if you drop inheritance from the object model of a distributed system, operations of kind 3 become important. For further arguments on this last issue you can read the article on Emerald in IEEE transactions on software engineering January 1987. --------------------------------------------------------------------- Anders Bjornerstedt E-mail: anders@cuisun.unige.ch Centre Universitaire d'Informatique 12 rue du Lac, CH-1207 Geneva --------------------------------------------------------------------- Tel: 41 (22) 787.65.80-87 Fax: 41 (22) 735.39.05 Home: 41 (22) 735.00.03 Telex: 423 801 UNI CH ---------------------------------------------------------------------