Path: utzoo!attcan!uunet!lll-winken!ames!sun-barr!apple!rutgers!att!westmark!mole-end!mat From: mat@mole-end.UUCP (Mark A Terribile) Newsgroups: comp.lang.c++ Subject: Re: address of virtual function (revisited) Summary: Rape is only rape in the absence of consent Message-ID: <183@mole-end.UUCP> Date: 11 May 89 11:38:34 GMT References: <8905100026.AA27112@yahi.stanford.edu> Organization: mole-end--private system. admin: mole-end!newtnews Lines: 48 [The debate about how to store and access the size of an object in an inheritance tree ... or anything else that is constant per base or derived type ...] > So, for example, right now, with my combination of cfront and back end > compiler, Jerry's approach, where you violate the encapsulation of an > object, access its instance variables directly, and lock future > derived classes into using one approach to returning "size", and force > a syntax of p->size rather than p->size() -- First, I think that Jerry's article about the protected interface and its intended customers answers this. It is often reasonable to make a design decision, in a particular circumstance, that constrains you later in some way. OOP people would like to have total code reusability. The problem with this approach is that the underlying algorithms have widely varying time and space properties and one solution is *rarely* correct for everything. See grep(1) on a version of ``The UNIX (tm, etc.) Time Sharing System.'' See the debate now raging on comp.lang.c about free store management. Sometimes you have to pay a price in generality to get performance. C++ allows you to make these decisions; it does not force the answers on you. > For crying out loud! If you are so concerned about performance that > you would be willing to rape your code if it saved you a few cycles, > how about this radical approach: write in the object oriented style, > AND GET A REAL MACHINE. ... The job of the engineer is to move those cost/performance/reliability curves that he can to the best advantage. That doesn't mean that he can change his environment. If there is a glut of cheap 8088s around, he can build a cheaper product, sell more, and thereby pay for more effort to improve the performance and reliability. He can also return more money to the stockholders, who will respond by asking him to do something else that they find useful (i.e. profitable to them and *presumably* to the people who buy the product because they find it useful). The discussions here show that C++, by not imposing its own ``compleat'' definition of OOP, is engendering all sorts of interesting debate about how OOP can be used to real effect in the real world. THIS IS GOOD. On the other hand, using the word ``rape'' to describe consensual union between those who (presumably) have the right to that union is distortion and pointless inflammation of passions. -- (This man's opinions are his own.) From mole-end Mark Terribile