[Zope-dev] Implementing ZPattern: Containment

Steve Spicklemire steve@spvi.com
Wed, 21 Mar 2001 08:39:46 -0500 (EST)


Hi Johan,

I wrote:

> The best way I've found is to provide a method (or methods) in the 
> Specialist of the contained item to get ids of those instances satisfying certain 
> criteria... 
> 
> e.g., getToDoIdsForDoer( aDoer )
> 
> (the contained item keeps a reference to the id of its container.)

then you replied:

> How well does this apply to the WhoIKnow pattern?
> Could you say that the Specialist is the association?
> In that case how do I create a n-n relation, or maybe I never do that?
> I can't really find any Patterns that matches n-n situation, so I assume
> it my modell probally would wrong if I end up with that, right?
> 
>    

then I went on vacation. ;-)

I think that in most of these situations you can have a 'catalogish' method in
the Specialist that manages the 'n' things that finds those related to the '1'.
(e.g., getToDoIdsForDoer( aDoer )). This can then be mapped to an attribute
of the '1' specailist (myToDos), so that it does 'know' about all it's todos,
its just that under the covers (in it's rack) the myToDos attribute is really
fulfilled by calling the todos specialist and asking for all the todos assocaited
with a particular doer. In the n-n case it's really no different, except that
each 'n' thing needs to know which of the other 'n' thing(s) it's associated with
so the catalogish method can pull out the ids. 

fun eh?

take care,
-steve