• 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
Re: Object Hierarchies
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Object Hierarchies


  • Subject: Re: Object Hierarchies
  • From: Lars von Wedel <email@hidden>
  • Date: Mon, 30 Apr 2007 08:59:45 +0200


Dear Sam,

We have a hierarchy of objects, each having a
list of lower-level objects, i.e.:

Course -> Session -> Segment -> Scene -> Shot -> Layer -> Shape ->
ContentProperties

Does it make sense, a la MailDemo, to subclass these from a common class
having only two instance variables, i.e., an (NSMutableArray*) sublist and an
(NSMutableDictionary*)properties, the latter of which would be individually
initialized with all the keyed properties associated with the particular
subclass? Or maybe even just use one class with individual initializers?

From my past experiences (which are not Cocoa) I would not recommend to artificially flatten such class hierarchies. Having just one class to actually represent a number of different concepts will prevent (or at least make it very tedious) to define methods particular for each concept. I cannot see why this should be any different in Cocoa/ Objective-C.


What might be useful though is to a have an abstract superclass that permits access to common things like a label, the set of children etc.

As Matt pointed out, you might want to take a look at CoreData which simplifies development of such applications.

Lars
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Object Hierarchies (From: Sam Colombo <email@hidden>)

  • Prev by Date: EPS NSPrintOperation not working as set
  • Next by Date: Re: Handling malformed xml and preserving newlines while creating NSXmlDocument
  • Previous by thread: Object Hierarchies
  • Next by thread: Re: Object Hierarchies
  • Index(es):
    • Date
    • Thread