[Zope-dev] adapter vs factory Re: implementing zope.component 4.0

Gary Poster gary.poster at gmail.com
Mon Nov 30 19:26:15 EST 2009

On Nov 30, 2009, at 5:14 PM, Lennart Regebro wrote:

> On Mon, Nov 30, 2009 at 22:40, Gary Poster <gary.poster at gmail.com> wrote:
>> Then to the multiadapter concern I raised, all my real-world examples of adapters are to adapt one object so it can be used in a certain way (to integrate with another kind of object).  Power adapters, for instance, adapt a plug (required interface) so it can plugged in to the wall (output interface).  Is there a common real-world example of this for "multiadapters"?
> Yup. http://www.amazon.co.uk/Scart-Adapter-Switchable-Plug-Socket/dp/B00077DC6A
> Audio + Video in: SCART out. :)

heh.  And Shane's example was more commonplace.  I still think this is unusual, or in Shane's example, not something that people think of as a multiadapter.

But as  said, to Fred, point partly taken. :-)

[snip utility/singleton]

>> That said, and to repeat, I mind "adapter" more than "utility."
> But adapter is really what it is. OK, Multiadapters are evidently
> complicated... But is it really so complicated that we should throw
> away the commonly accepted GoF for what clearly are adapters? How is
> it less confusing to call IFoo.instance(x,y) than IFoo.adapt(x,y) or
> even IFoo(x,y)?

I am very much in favor of IFoo(x, y).  That makes me very happy.  It looks mostly like you are instantiating a class, except that it looks a bit funny: in my view, it is a reasonably good leaky abstraction for what is going on.

People also like the compactness of the spelling, in my discussions.  They also remember it very well, even over long periods of not using the API.  This is a big deal.

Backwards compatibility is the problem.

I need to go have a life. :-) 

Talk to you all tomorrow.


More information about the Zope-Dev mailing list