W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2002

Re: Schema Design: Composition vs Subclassing

From: Jeni Tennison <jeni@jenitennison.com>
Date: Mon, 15 Apr 2002 16:15:40 +0100
Message-ID: <681150918012.20020415161540@jenitennison.com>
To: "Roger L. Costello" <costello@mitre.org>
CC: xmlschema-dev@w3.org, paul.w.daisey@census.gov, Simon.Cox@csiro.au

>> 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."

Could you expand on how you see Delegation being used within an XML
Schema such that an application can take advantage of it in the same
way as it could were the type hierarchy used?

For example, given the Camera type hierarchy described in your web
page, I could (eventually, come XSLT 2.0) do:

<xsl:template match="*[type() = 'Camera']">
  ... do some processing common to all cameras ...

How do you see the Delegation pattern helping here?



Jeni Tennison
Received on Monday, 15 April 2002 11:15:42 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:56 UTC