• 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: Struct, Object, or Dictionary?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Struct, Object, or Dictionary?


  • Subject: Re: Struct, Object, or Dictionary?
  • From: lbland <email@hidden>
  • Date: Tue, 1 Jul 2008 14:45:49 -0400

hi-

If you have to bind your entities to anything then you might try a Core Data representation.

If you have multiple entities and need to store in a list then a dictionary or class would be best as NSArray, etc. takes ids and there is no easy store for multiple structs, unless you role your own.

The Core Data would be New-Cocoa-Cool IMHO.

thanks!-

-lance


On Jul 1, 2008, at 1:53 PM, Bridger Maxwell wrote:

Hey,
I have been debating using one method over another for a while now, and I
would like to know what the Cocoa way of doing things is. I need to group a
set of data together to use as one entity. In one program I was representing
a puzzle as four strings and a BOOL. My first thought would be to represent
these as a struct. However, the strings within the struct would have to be
memory managed, so I guess that would mean writing my own methods to retain,
release, autorelease, etc. the struct. My second option in this case is to
declare an object that would contain all of those data members as ivars, and
the memory management would be taken care of. However, it doesn't seem right
to make an object that only has data and no methods. My third option would
be to store all of the data in dictionary pairs. This doesn't seem as
reliable as the last methods though, because there is no guarantee that the
dictionary would contain all the necessary name/value pairs. What is the
"correct" way to do this in Cocoa?


Thank You,
Bridger Maxwell
_______________________________________________

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

_______________________________________________

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


  • Follow-Ups:
    • Re: Struct, Object, or Dictionary?
      • From: mmalc Crawford <email@hidden>
References: 
 >Struct, Object, or Dictionary? (From: "Bridger Maxwell" <email@hidden>)

  • Prev by Date: Re: Struct, Object, or Dictionary?
  • Next by Date: Re: How to make the FileOwner of a nib file accessible globally in whole project
  • Previous by thread: Re: Struct, Object, or Dictionary?
  • Next by thread: Re: Struct, Object, or Dictionary?
  • Index(es):
    • Date
    • Thread