[Zope3-dev] Adapters & Interface Implementations (was Re: [Zope-dev] Cool stuff!)
Martijn Faassen
faassen@vet.uu.nl
Thu, 6 Dec 2001 22:22:22 +0100
Phillip J. Eby wrote:
[snip]
> As for "Adapter" being the wrong GoF patterns term, I'm pretty sure it's
> not. I've got the "Design Patterns" book open to "Adapter" right now, and
> the Applicability section says:
[snip]
> So I don't see where calling these things adapters conflicts with the GoF
> patterns usage at all.
Thanks for looking this up, agreed.
> What I propose, then, is that the documentation (and API naming) focus on
> getting an implementation of an interface, and that the term for an adapted
> interface be "adapter". So a description of
> getImplementation(object,interface,default) might read:
>
> "Get an implementation of Interface 'interface' for 'object'. If 'object'
> supports 'interface' directly, 'object' is returned. Otherwise, creates
> and returns an adapter object that implements 'interface' for 'object', if
> an appropriate adapter type can be found. If no such adapter type can be
> found, returns 'default'. Adapter types are found by blah blah... placeful
> lookups blah blah... registry etc...."
At first sight this looks good as well.
Regards,
Martijn