Struct, Object, or Dictionary?
Struct, Object, or Dictionary?
- Subject: Struct, Object, or Dictionary?
- From: "Bridger Maxwell" <email@hidden>
- Date: Tue, 1 Jul 2008 11:53:48 -0600
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
- Follow-Ups:
- Re: Struct, Object, or Dictionary?
- From: lbland <email@hidden>
- Re: Struct, Object, or Dictionary?
- From: "Bridger Maxwell" <email@hidden>
- Re: Struct, Object, or Dictionary?
- From: Andy Lee <email@hidden>
- Re: Struct, Object, or Dictionary?
- From: Keary Suska <email@hidden>
- Re: Struct, Object, or Dictionary?
- From: James Bucanek <email@hidden>