• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
many-to-many relationships and object design
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: many-to-many relationships and object design
      • From: Tim Hart <email@hidden>
    • Re: many-to-many relationships and object design
      • From: mmalcolm crawford <email@hidden>
    • Re: many-to-many relationships and object design
      • From: Zach Paine <email@hidden>
  • Prev by Date: NSArrayController, a strange canEdit behaviour with datas
  • Next by Date: Re: many-to-many relationships and object design
  • Previous by thread: NSArrayController, a strange canEdit behaviour with datas
  • Next by thread: Re: many-to-many relationships and object design
  • Index(es):
    • Date
    • Thread