Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!uunet!igor!yoda!jls From: jls@yoda.Rational.COM (Jim Showalter) Newsgroups: comp.software-eng Subject: Re: Reusability considered harmful??(!!) Message-ID: Date: 27 Feb 91 01:26:28 GMT References: <88431@tut.cis.ohio-state.edu> <6108@stpstn.UUCP> <87829@tut.cis.ohio-state.edu> <6248@stpstn.UUCP> <1991Feb11.103100.112@skyler.mavd.honeywell.com> <34464@athertn.Atherton.COM> <88744@tut.cis.ohio-state.edu> <88851@tut.cis.ohio-state Sender: news@Rational.COM Lines: 68 >Briefly, what I mean by code inheritance is a situation in which an >heir may directly manipulate the internal representational details of >its ancestor(s). That is, unlike an ordinary client of a component -- >which must rely on an abstract description of the component's behavior >and may use only the interface operations/methods in order to >manipulate it -- an heir using code inheritance may see and directly >manipulate the ancestor's internal representational details, bypassing >the interface operations/methods. I can't speak for other inheritance-oriented languages, but it is certainly the case in C++ that heirs do NOT have direct access to the private data of the ancestor, any more than does any other client. Heirs read/modify said private data only through the exported operations provided by the ancestor. (Protected data and friend classes are another matter entirely, but we strongly discourage their use for just that reason.) In short, there are some things you don't even let your children see! >If an heir is not permitted to >violate abstraction like this, what is the use of code inheritance? >The heir might as well be an ordinary client. Not true. The value of code inheritance is 1) getting ancestor operations for free and 2) polymorphism. There has never to my knowledge been a claim made that inheritance is neat because it allows heirs to diddle ancestors' private data. >The difficulties with verification, testing, etc., arise because of >implementation "conventions" that were used by the ancestor's >implementor, but which are not stated explicitly in the code itself >(because most languages don't have any constructs in which to express >them). The problems arise even when the heir is permitted only to >manipulate the current internal representation of its ancestor. It is >not necessary that the heir be able to add "representation features" >(or whatever you want to call them) in order for these problems to >occur. >For example, the implementor of the ancestor might be relying on some >particular relation (a representation invariant) holding at all times. >If an heir comes along and manipulates the representation in such a >way that this invariant is violated then the ancestor's operations may >be broken. No one has touched the code of the ancestor, but they need >to be reverified, retested, whatever. This is a disaster. All moot if heirs are limited to ancestor's exported operations. Please excuse this idiotic text here. I am putting it here because my first attempt to post this was met by the incredibly idiotic message "Article rejected: news included more text than new text". So here is some more text blah blah blah blah blah blah blah blah, etc. I sure wish I could disable this "feature" (any feature that cannot be disabled is a bug). And here is even more idiotic text. Followed by some more of it. Blah blah yadda dadda da. Arglebargle ishkabibble iggeldy diggeldy do. Am I done yet? Do I have enough yet? Is that enough idiotic text to pacify the newsreader gods? If not, here is another paragraph of this swill. Blah blah blah blah what a stoopid feature... Argh!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -- ***** DISCLAIMER: The opinions expressed herein are my own. Duh. Like you'd ever be able to find a company (or, for that matter, very many people) with opinions like mine. -- "When I want your opinion, I'll beat it out of you." Brought to you by Super Global Mega Corp .com