Wichert Akkerman <[email protected]>
writes:

> On 6/29/09 4:49 PM, Ross Patterson wrote:
>> Wichert Akkerman<[email protected]>  writes:
>>
>>> I see the problem Ross is trying to solve: generating a list of
>>> everything an object can be adapted to is expensive (which is why the
>>> same thing was removed from the Plone 3.x tree just before 3.0).
>>>
>>> This solution moves the penalty to the developer: instead of only
>>> having to write an adapter developers are now forced to register both
>>> an adapter and a new marker interface. I feel quite strongly that this
>>> repetition is not desirable, so I want to investigate alternatives.
>>
>> If by "register" you mean the "<interface>" registration, the developer
>> would not need to do that.  All the developer would need to do is make
>> sure the class implements the marker interface which can be done in the
>> class level implements declaration or in ZCML.  This is one of the most
>> simple declarations possible.
>
> Sure, but my point is that this shoudl not be necessary. Why should we
> force developers to both register a marker interface and an adapter?
> That is the kind of extra repetition and extra work that we are now
> working hard on removing from Plone.

There's a simpler way to remove the requirement that objects which
directly provide the membrane interface to also provide the marker
I*Avail interface.  The object_implements indexer simply checks the
membrane interfaces first and falls back to checking the corresponding
I*Avail interface.  I've just committed this work to trunk.

With this in place, a class only needs to declare that it implements the
I*Avail interface if instances do not directly provide the membrane
interface but can be adapted to it.  IOW, if you're implementing
something that directly provides a membrane interface you simply say so
just as you used to before.  If you're implementing an *adapter* for
something or something that can be *adapted to* one of the membrane
interface, then you say so by declaring that the I*Avail interface is
provided by instances.  This seems to me to be a good balance between
developer convenience, a clear implementation, and explicitness.

Looking at the code, it seems that there's already such a layer of
interface indirection in place.  Consider IUserAuthProvider and
IPropertiesProvider in Products.membrane.at.interfaces.  Classes that
implement these interfaces don't provide any implementation, instead
adapters to IMembraneUserObject, IMembraneUserAuth, and
IMembraneUserProperties (the queryable interfaces) are provided.  So
I've just made those interfaces extend the I*Avail variety.

On a related note, I'd like to get your feedback on the other recent
posts some of which relate to your contributions.  In particular, I'd
like to get your feedback on removing the extra layer of IUserAuth
indirection and on moving some stuff that need not depend on AT out of
the at package:

http://thread.gmane.org/gmane.comp.web.zope.plone.remember/683

Thanks!
Ross



--
Archive: 
http://www.coactivate.org/projects/remember/lists/remember/archive/2009/07/1247338412088
To unsubscribe send an email with subject "unsubscribe" to 
[email protected].  Please contact 
[email protected] for questions.

Reply via email to