[ZODB-Dev] Implementing Storage Decorators

Tino Wildenhain tino at wildenhain.de
Fri May 4 15:52:44 EDT 2007


Dieter Maurer schrieb:
> Jim Fulton wrote at 2007-5-4 14:40 -0400:
>> On May 4, 2007, at 2:33 PM, Dieter Maurer wrote:
>>
>>> Jim Fulton wrote at 2007-5-2 11:52 -0400:
>>>> ...
>>>> I think I still rather like explicit, but I'm on the fence about
>>>> which approach is best.  What do other people think?
>>>> From your description, I would use a subclassing (and forget about
>>> proxy and copying).
>> That would be a nightmare, on multiple levels:
>>
>> - All of the separate implementations would become tightly coupled,  
>> which is what happens with inheritance.
>>
>> - Either someone would have to create classes for the various  
>> permutations of features, or consumers would have to mix and match  
>> multiple classes to get what they want and sort out the variate  
>> internal implementation incompatibilities.
> 
> Your decorators would become mixin classes
> and the final classes would list the features they like -- simpler
> than ZCML binding together...
> 
> Of course, some features may not play well with one another.
> But, that will make problems also with proxies or copying...

Even this could be sorted out with special cleanup or
secure mixins which can do dirty tricks like accessing
self.__class__.__bases__ to fixup ;) (Much like combining
the copy with the subclass approach)

I'm for mixin with strong guidelines on implementation
(e.g. how to call private attributes to not pollute the
  namespace)

Regards
Tino


More information about the ZODB-Dev mailing list