[Zope3-Users] Expressing n:m relationship in ZODB
domma at procoders.net
Tue Jul 11 18:40:50 EDT 2006
Leonardo Rochael Almeida wrote:
> In usual Object Oriented modeling, an n:m relationship is usually
> modeled as a collection of relationship objects each one keeping one
> direct reference to each side of the relationship. Of course, using
> these systems that already try to model relationships helps you not to
> reinvent another wheel.
I think I understand. So if I would like to reinvent another wheel, just
for the educatinal purpose, I should do it like this:
If I have IArticle and IProject which should have a relationship, I
would introduce IArticleProjectRelation which holds a reference to the
related objects. These relation objects will be managed by an
IArticleProjectRelationManager which has an interface like:
In that case, IArticleProjectRelation would be an implementation detail
of IArticleProjectRelationManager and I do not have to expose it at all.
And in Zope 3 terms, I would implement the manager as a local utility.
Right so far?
If yes, I could add helper methods to IArticle and IProject which
encapsulate the access of the utility to hide this detail from the user.
Would you do that? Or has it some drawbacks which I don't see yet?
thanks for your help,
More information about the Zope3-users