[Zope-dev] implementing zope.component 4.0

Charlie Clark charlie.clark at clark-consulting.eu
Sat Nov 28 09:10:46 EST 2009


Am 27.11.2009, 15:57 Uhr, schrieb Chris Withers <chris at simplistix.co.uk>:

> Well, I don't think the difference between adapters and utilities is
> important, but I can understand why some people find calling the
> interface odd: it is when you think about it objectively.

I have to agree with this. IFoo(myobject) is not intuitive. I know it used  
a lot because it's convenient shorthand but I've never read anywhere that  
interface classes are, in fact, callables. We certainly don't normally  
treat them as such.

One of the things that I have grown to appreciate with the ZCA is the  
advantage of spelling out the relationship between objects and I'll  
happily take a little verbosity over magic.

The discussion does highlight a key source of confusion about Zope  
interfaces: they are, at the same time, an object specification and a kind  
of name tag or token that objects can provide upon request. While I know  
that the second function is derived from the first it is conceptually  
different.

My preference, for the sake of clarity:

adapted = an_easy_way_to_the_registry.adapt(*objects_to_be_adapted,  
**identifiers)

That adapters are all callable now seems to be an accepted convention,  
presumably from convenience. But my understanding of adapters does not  
imply this.

Charlie
-- 
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226


More information about the Zope-Dev mailing list