Re: Schema Design: Composition vs Subclassing

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 UTC