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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,9a0ff0bffdf63657 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public X-Google-Thread: f43e6,9a0ff0bffdf63657 X-Google-Attributes: gidf43e6,public X-Google-Thread: 1108a1,9a0ff0bffdf63657 X-Google-Attributes: gid1108a1,public From: ell@access.digex.net (Ell) Subject: Re: Module size (was Re: Software landmines) Date: 1998/09/04 Message-ID: <35f3016d.57964308@news.erols.com>#1/1 X-Deja-AN: 387874794 Content-Transfer-Encoding: 7bit References: <6snlos$bh6$1@hirame.wwa.com> <904912650snz@nezumi.demon.co.uk> <35EFFB78.21BBBED6@ksc.nasa.gov> Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@rcn.com X-Trace: winter.news.erols.com 904924622 9853 207.172.41.199 (4 Sep 1998 15:57:02 GMT) Organization: Universe Mime-Version: 1.0 Reply-To: ell@access.digex.net Newsgroups: comp.lang.eiffel,comp.object,comp.software-eng,comp.lang.ada Date: 1998-09-04T00:00:00+00:00 List-Id: "Christopher P. Gariepy" wrote: >Martin Tom Brown wrote: > > > >He used to program for a living, but he's never done real work in an OO > >language. When I tell him the project has 510 classes, with 2871 methods, > >he nods his head wisely. But when I tell him that 965 of those methods > >contain one line of code each, he starts to frown. He asks me if maybe > >we're taking modularization a bit too far. When I tell him that we have > >63 methods that contain zero lines of code, he wants to know why we > >bothered to write them in the first place, if they don't do anything. >I'm fairly new to the OO methodology, and I can see a reason to, perhaps,have >methods with 1 line of code - especially if the method is used in >numerous places. > >But...I see no reason to have methods that contain no code at all, even if >they're meant for place-holders. I believe this could potentially create >a maintenance nightmare if the original designers of the system are not >involved in the maintenance of the system. Using C++, a 0 line method in a class is typically what is called a "pure virtual function". They are intended to force classes inheriting from the class with a pure virtual function to implement the function themselves. Typically, in C++, such pure virtual functions are only placed in the parent class of an inheritance hierarchy. Most classes which inherit from the parent class do in fact implement the pure virtual functions. In C++, a class with on or more pure virtual functions is called an abstract base class (ABC). class ABC { public: virtual void functionA( ) = 0; virtual void functionB( ) = 0; }; functionA( ) and functionB( ), while declared here with 0 lines of implementation code, are required to be implemented by all classes inheriting from class ABC for which it is possible to create run-time objects of those inheriting classes. class InheritsFromABC : public ABC { public: void functionA ( ) { // some implementation } void functionB ( ) { // some implementation } }; Elliott