many-to-many relationships and object design
many-to-many relationships and object design
- Subject: many-to-many relationships and object design
- From: Todd Ransom <email@hidden>
- Date: Thu, 17 Jun 2004 19:39:03 -0600
Hello,
I'm new to Cocoa, Objective-C and OOP but I recently started a project
to create an outliner app for writers. I have been struggling with how
to design my model objects.
My current model is simple - I have an NSDocument subclass. This class
has arrays of objects for actors and scenes. This works great until I
want to create a relationship between the two. An actor can
participate in multiple scenes and a scene can contain multiple actors.
I have considered creating a relationship class that would act as a
table (like a relationship table in a RDBMS) but this seemed like it
would be complicated to implement. I tried storing an array of actors
in each scene object but then I needed a way for the scene to resolve
actor ids to actor objects. Since the actor objects only know about
themselves I put this in the NSDocument subclass. But now I can't seem
to think of a reasonable way for the scene objects to know which
instance of the NSDocument subclass they belong to. I get the feeling
that I am trying to work my way through a problem that has a fairly
simple solution if only I had more experience with OO design.
Any pointers to info, suggested solutions, or links to source on this
would be greatly appreciated. I looked at Apple's docs on "object
modeling" but I couldn't turn the abstract information there into any
real ideas on how to implement this.
thanks,
TR
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.