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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,9aa4a1851f1e4800 X-Google-Attributes: gid109fba,public X-Google-Thread: fac41,e8c725ea56364578,start X-Google-Attributes: gidfac41,public X-Google-Thread: f5d71,30c97c79ca78278e X-Google-Attributes: gidf5d71,public X-Google-Thread: 114809,9aa4a1851f1e4800 X-Google-Attributes: gid114809,public X-Google-Thread: 103376,e8c725ea56364578,start X-Google-Attributes: gid103376,public From: Richard Riehle Subject: Re: abstraction and encapsulation (Re: Will Java kill C++?) Date: 1996/05/13 Message-ID: #1/1 X-Deja-AN: 154574868 references: <4mgcgn$au4@newsbf02.news.aol.com><4mjem8$q4k@colossus.holonet.net> to: "." content-type: TEXT/PLAIN; charset=US-ASCII organization: National University, San Diego mime-version: 1.0 newsgroups: comp.lang.java,comp.lang.c++,comp.lang.eiffel,comp.lang.ada,comp.lang.smalltalk Date: 1996-05-13T00:00:00+00:00 List-Id: On 13 May 1996, . wrote: > A fundamental problem of most object oriented languages is that they > encapsulate behavior too much: Yes. This was one of the annoying issues with the earlier Ada standard. It was both a strength and a weakness. It has been fixed in some rather clever, and quite useful ways, in the new Ada 95 standard. > you can't easily encapsulate behavior > that depends on the internals of multiple objects ("friend" etc. are > failed attempts to work around that). I think the operative phrase is, "Don't make 'friends' with C++." Invading an encapsulation via "friends" is the equivalent of breaking it. But I'm not sure there is any other way in C++. > Another problem is that many > entities in actual programs do not deserve to be "abstracted"; they > should remain anonymous and largely unseen. Perhaps the issue is one of "levels of abstraction" rather than don't do abstraction. Unfortunately, many languages do not provide a range of options for creating levels of abstraction. Inheritance, by itself, may not be enough. > Many of the more recent > object oriented languages (C++, Java, etc.) force you to go overboard > and provide named abstractions for something as trivial as multiple > return values or a callback. Fortunately, Ada does not "force you to go overboard" in this way. "Sometimes", to quote Sigmund Freud, "a cigar is just a cigar." On the other hand, the practice of using named abstractions for everything is probably not evil. When used intelligently, it can make a design more extensible. Sometimes we fail to realize, in our zeal for software reuse, that extensibility is just as important, maybe even more important, than reuse. In this regard, all the OOP languages, those you have named, plus Eiffel and Ada, work out pretty well. Richard Riehle