• 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: Dictionaries vs iVars
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dictionaries vs iVars


  • Subject: Re: Dictionaries vs iVars
  • From: Robert Walker <email@hidden>
  • Date: Wed, 27 Jun 2007 17:31:00 -0400

Isn't that "loosely" how NSManagedObject works? Aren't the properties basically stored in an NSDictionary and read via KVC?

On Jun 27, 2007, at 5:14 PM, Dorian Johnson wrote:

I'm using this approach for a similar purpose. I'm simply doing it because it makes serialization to file *really* easy. If the properties are accessed a LOT, you'll run into performance problems, but it definitely adds some flexibility.

Be careful, though, that you only use this for data objects and that it doesn't convolute your object heirarchy. If it makes sense for the objects themselves to perform actions (eg, drawing?), then it makes no sense to use the dictionary approach.

It really depends on your needs. Run some profiling in shark - I'll bet that you'll find that about 1% of time is spent on the dictionary stuff.

On Jun 27, 2007, at 3:54 PM, Gordon Apple wrote:

I'm still toying with the idea of using dictionaries instead of iVars in
my graphics objects and other types of data objects. My thinking is to have
only one type of graphic object with a single dictionary and let the
relevant controller dynamically add properties as needed, e.g., shadows,
borders, shaders, content (pictures, QT, text, etc.) These can all be
accessed by key value by the renderer and editor. This seems like it would
be a tremendous simplification of design and would offer great flexibility
for later feature additions. It seems like it could simplify the inspector
interface. It could also make it easy to view data structures when needed
without having to resort to the debugger (e.g., field maintenance).


    I would like to hear any comments on this approach.  For example,
performance hits?  Has anyone tried this?

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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:
40mac.com


This email sent to email@hidden

-- Robert Walker email@hidden



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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: 
 >Dictionaries vs iVars (From: Gordon Apple <email@hidden>)
 >Re: Dictionaries vs iVars (From: Dorian Johnson <email@hidden>)

  • Prev by Date: Re: Dictionaries vs iVars
  • Next by Date: Re: Guidance for learner
  • Previous by thread: Re: Dictionaries vs iVars
  • Next by thread: Bindings with a custom view
  • Index(es):
    • Date
    • Thread