[Zope3-dev] persistence by adaptation, and aop?
Phillip J. Eby
pje@telecommunity.com
Tue, 03 Jun 2003 12:07:11 -0400
At 11:59 AM 6/3/03 -0400, Ken Manheimer wrote:
>(I may be off base comparing the component approach with aspect
>oriented programming. I strongly suspect, though, that they address
>the same purpose. That purpose is something like packaging
>functionality so it can be conveyed to any situation where it is
>useful without being locked in with other, independent functionality.
>And form the little i've seen of AOP approaches, components seem to me
>to encapsulate the extensibility in way that's much more congruent
>with the rest of OOP...)
I've previously considered using AOP to do persistence. But it pretty much
turned out that all I did with it was use it to mix in the Persistent
base! Zope's persistent base class does almost everything you could want
in a persistence mechanism, without the overheads that sort of thing would
incur in Java. The big wins in Java of using AOP for persistence are because:
1. There's no multiple inheritance in Java
2. There's no dynamic hooking of attribute access in Java
Python doesn't have either of these issues. The only issue in Python
persistence is mutable attributes (e.g. lists). You could use AOP to
address that, I suppose. But you'd have to have established a certain
amount of encapsulation discipline over the attributes in the first place,
for the control to be effective.
So, although I'm generally an AOP fan, I'd say it doesn't give you any big
wins over the current Persistent mixin technique.