[Zope3-dev] Re: adaptation based on class rather than interface

Philipp von Weitershausen philipp at weitershausen.de
Mon Nov 13 05:39:17 EST 2006


Jean-Marc Orliaguet wrote:
> Martin Aspeli wrote:
>> Jean-Marc Orliaguet wrote:
>>
>>> And there is nothing wrong with using inheritance when there is a 
>>> '__IS A __' type of relation (e.g. an ordered folder IS A folder IS 
>>> AN item, ...), or if there is a HAS_A type of relation (a folder has 
>>> items, a chair has four legs...). It seems that Zope3 has banned all 
>>> form of class inheritance, even those that made sense, and that would 
>>> have simplified the implementation.
...
> 
> subclassing is not used in zope3 as a method for assembling components, 
> as it was used in zope2.

At least it's not encouraged. It's still possible and sometimes it makes 
sense.

> In zope2, if you mix a folder with a catalog 
> aware mixin, you'd have a catalog-aware folder because the functionality 
> is expressed in the mixin class, not outside.

Right, the idea of components is separation of responsibilities. Content 
objects that just worry about storage don't have to know about this 
funky thing called the catalog anymore. Or FTP access. Or WebDAV 
locking. Or ... You get the idea.

> In zope3 if you subclass a 
> container you still have a container, it won't make the container more 
> specialized.

Well, that depends on what you do in the subclass. I have made 
"specialized" (whatever that means) containers by subclassing 
BTreeContainer, for example.


-- 
http://worldcookery.com -- Professional Zope documentation and training


More information about the Zope3-dev mailing list