RE: Schema Design: Composition vs Subclassing

Looks good Roger! You are definitely correct in that the XML community is
seriously overusing the Subclassing method.  I also believe that designing
by Composition also forces the XML community to look at the big picture.

This was an excellent topic to discuss.  Thanks again!

Andy Del Rio
Decade Systems
(904)285-9363 Extension 19
adelrio@decadesystems.com

-----Original Message-----
From: xmlschema-dev-request@w3.org
[mailto:xmlschema-dev-request@w3.org]On Behalf Of Roger L. Costello
Sent: Monday, April 15, 2002 8:38 AM
To: xmlschema-dev@w3.org
Cc: Jeni Tennison; paul.w.daisey@census.gov; Simon.Cox@csiro.au;
costello@mitre.org
Subject: Re: Schema Design: Composition vs Subclassing


Hi Folks,

A couple of weeks ago I raised the topic: which approach is to be
favored - design by subclassing or design by composition.  There were
numerous responses, largely in favor of subclassing.

Since that time I have gone off and done some thinking and researched
how this design issue is approached in the Object-Oriented field.  As a
result I have now convinced myself that composition should be the
favored approach (as it is in the OO field).  I have written up this
issue and posted it on the BestPracticesHomepage:

http://www.xfront.com/composition-versus-subclassing.html

Any comments on this would be appreciated.

The paper addresses most of the issues that were raised a couple of
weeks ago.  The one issue that it does not address I do so here:

> I think that design-by-subclassing has one killer advantage,
> namely that applications can use information about the type hierarchy
> in order to provide common processing for all elements of a particular
> (high level) type.

My response to this is to quote from the Design Patterns book by Gamma
et al: "Delegation is a way of making composition as powerful for reuse
as inheritance.  In delegation, two objects are involved in handling a
request: a receiving object delegates operations to its delegate.  This
is analogous to subclasses deferring requests to parent classes."

/Roger

Received on Monday, 15 April 2002 13:56:46 UTC