"Inheritance considered harmful"
john at datachannel.com
Fri Apr 3 02:14:35 BST 1998
A note and a question.
Note though that in Java (and seemingly in COM+) there are two types of
interitance. There are the notions of superInterface and superClass.
Class inheritance is the tradition OO concept of "getting code for free."
The follow is a definition of a Java interface with no superInterface
inheritance going on:
public abstract void aMethod( long myParam );
public abstract int bMethod();
which is equivalent to:
void aMethod( long myParam );
All methods in Java interfaces are public and abstract. There is never any
code associated. A class which says it implements this interface must define
code for all the methods in the interface e.g.:
class Somethinger implements Somethingable
void aMethod( long myParam )
// do something with the myParam
The interface inheritance happens when a interface extends another
interface. Here is an interface which inherits the above interface:
interface EvenMorable extends Somethingable
boolean dMethod( int someParam );
A class which says it implements the interface EvenMorable must have method
bodies for aMethod, bMethod and dMethod (or declare that it is abstract and
so must be extended by some other class (class inheritance) which implements
the unsatisfied methods of the interface.
The question: While class inheritance does not map to Architectural forms,
does interface inheritance map to Architectural forms?
From: W. Eliot Kimber <eliot at isogen.com>
To: xml-dev at ic.ac.uk <xml-dev at ic.ac.uk>
Date: Thursday, April 02, 1998 12:42 PM
Subject: Re: "Inheritance considered harmful"
>At 03:08 PM 4/2/98 -0500, Paul Prescod wrote:
>>On Thu, 2 Apr 1998, W. Eliot Kimber wrote:
>>> That's probably because the architecture facility of ISO/IEC 10744
>>> *do* inheritance in the way that most people seem to expect.
>>That's right. That's why people get so confused about them. The word
>>inheritance is inherently misleading when applied to architectural forms.
>>Architectural forms do subtyping, not inheritance. Inheritance is about
>>"getting stuff for free" (e.g. code, declarations, fields). Subtyping is
>>about *fulfilling a particular role* (perhaps through a manual
>>construction of an appropriate "interface" (in this case a content
>>model)). Architectural forms allow you to specify an interface that must
>>be fulfilled and declare conformance to that interface. It does not allow
>>you to "get code for free" (i.e. markup declarations).
>Paul has made clear what I was feebly trying to say: thanks Paul.
>W. Eliot Kimber, Senior Consulting SGML Engineer
>Highland Consulting, a division of ISOGEN International Corp.
>2200 N. Lamar St., Suite 230, Dallas, TX 95202. 214.953.0004
>xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
>Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
>To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
>To subscribe to the digests, mailto:majordomo at ic.ac.uk the following
>List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev