[Zope3-dev] zwiki: performance of findChildren()

sean.upton@uniontrib.com sean.upton@uniontrib.com
Mon, 05 May 2003 12:58:43 -0700


Not magical, but simple: what about wrapping the object with properties
instead of hard-coding descriptors into the class?  Assume the get/set
functions for the property added by the wrapper use a relationship
management service.  It isn't really "transparent" - but it only has to be
done once in code that uses multiple relationships. All application code
interested in reading/writing relationship info has the responsibility to
wrap.

# wrapping only adds properties and associated get/set
# methods to the wrapped object if attribute name 
# doesn't exist in the unwrapped object.
wrappedObj = relatonship_service.wrap(obj)
children = wrappedObj.children
parents = wrappedObj.parents

children = relationship_service.getRelated(obj, 'children')
#also works

Sean

-----Original Message-----
From: Shane Hathaway [mailto:shane@zope.com]
Sent: Monday, May 05, 2003 11:59 AM
To: Tres Seaver
Cc: Ken Manheimer; zope3-dev@zope.org
Subject: Re: [Zope3-dev] zwiki: performance of findChildren()


Tres Seaver wrote:
> On Mon, 2003-05-05 at 14:33, Shane Hathaway wrote:
>>individual.children
> 
> 
> This will break for the same reasons that hard-wiring views onto content
> classes do:  it is too hardwired, too majyk, and makes it impossible to
> change the policy without modifying code.  I would wager that almost
> *any* relationship which can't be modeled by containment (UML's
> "aggregation") should be moved outside the responsibility of the content
> class altogether.

Hmm, I haven't stated any implementation details, so nothing is 
hardwired.  It doesn't seem magical at all, either.  Think of it as a 
transparent component lookup.

Shane


_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
http://mail.zope.org/mailman/listinfo/zope3-dev