[Zope3-dev] Not really bringing the name game to a close, for now, are we?

Martijn Faassen faassen@vet.uu.nl
Tue, 11 Dec 2001 00:14:49 +0100


Jeffrey P Shell wrote:
> There are GoF patterns besides Adapter that might bear looking at.  

Interesting. I misplaced my Design Patterns book but this page is
interesting:

http://rampages.onramp.net/~huston/dp/decorator.html

Particularly this:

"""
Adapter provides a different interface to its subject. Proxy provides
the same interface. Decorator provides an enhanced interface.
"""

Also there was a note that the decorator pattern is sometimes also named
wrapper, and that touches upon what ParsedXML does in using proxy wrappers;
they're in fact decorators in that they provide the DOM interface, but
add several methods to it to make them work within the ZMI. XMLWidgets 
takes this a step further in determining which decorator gets associated
with which node dependent on information in both the node and in the context.

This also touches upon my sadly undercommented (not understood?) discussion
here (even though I didn't think in GoF terms):

http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/ExplicitVersusImplicitFeatureWrapping

'Extending interface' describes decorators, I think now, while 
'New interface' describes adapters. Implicit versus explicit is how you
actually ask for these interfaces which is somewhat orthogonal to the
whole decorator versus adapter issue.

I think we need both decorators and adapters. Decorators can be seen
as adaptors that 'happen to' implement the adapted interface as well, 
usually by just proxying it directly to the original object.

Regards,

Martijn