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
Roger,

>> 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 ...
</xsl:template>

How do you see the Delegation pattern helping here?

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Monday, 15 April 2002 11:15:42 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:30 GMT