Path: utzoo!attcan!uunet!grand!day From: day@grand.UUCP (Dave Yost) Newsgroups: comp.lang.eiffel Subject: reusability of code in object oriented design Message-ID: <473@grand.UUCP> Date: 21 Dec 88 18:18:56 GMT Reply-To: "Andrew K. Wright" Organization: Grand Software, Inc., 213-650-1089, Los Angeles, CA Lines: 30 From: "Andrew K. Wright" Date: Thu, 24 Nov 88 13:48:48 EST In most object oriented languages, when a new class is defined, its operations are implicitly reusable by a subclass. That is, without the user going to any effort, any code (operations) written are reusable. In fact, object oriented languages in which the user can indicate that code, or a class, is NOT reusable are few. I have the feeling that in order to create a class with a fair chance of being reused, the user must be intending to create a reusable class. In C++, this is, in some ways, required by the language: the "virtual" keyword must be used by the class designer if a derived class is to redefine parent class operations and behave properly. This is not true of Eiffel (each operation is implicitly virtual). In order to gather some feedback about what other object-oriented designers have encountered, I will challenge the notion that classes can be designed without the intent of reuse, and effectively reused later. I contend that only through freak accidents are classes reused, unless they were intended for reuse. Thus C++ classes containing "virtual", and Eiffel classes containing "deferred" are definitely not eligible, because they were clearly intended for reuse. Classes which had to be modified to achieve reuse do not count either. What percentage of your classes which you did not originally intend to reuse do you actually derive from? Andrew K. Wright akwright@watmath.waterloo.edu CS Dept., University of Waterloo, Ont., Canada.