Re: Collections can be simple Attributes in Core Data
Re: Collections can be simple Attributes in Core Data
- Subject: Re: Collections can be simple Attributes in Core Data
- From: "I. Savant" <email@hidden>
- Date: Tue, 30 Sep 2008 13:58:38 -0400
On Mon, Sep 29, 2008 at 3:03 AM, Negm-Awad Amin <email@hidden> wrote:
>> But now I find there is an even more natural way, which is to just leave
>> them as a set or array, and store in an attribute of type Transformable.
>> The default transformer en/decodes the collection into/from an NSData, and
>> everything "just works".
>>
>> I'm surprised that I've never seen this discussed or documented. Is this
>> going to get me into any trouble?
>
> Yes, because you get redundant and inconsistent model.
If I'm reading this right, Jerry has a simple attribute called "pet
names". Usually this is used as a personally-identifiable unit of
information. Sure, lots of people might have fluffy, but do you really
need to have a "PetName" entity, checking to see if an instance with
"name" property equal to "Fluffy" exists, creating one if not? In this
case (where we just want to store a short list of very personal things
as an attribute), sure you can archive an array or a set, just like
any other archiveable object.
Now if the application needs to track people and their pets, I'd
imagine you'd have a whole "Pet" entity with a "name" property, but
that doesn't sound like what Jerry is getting at ...
The 'correct' approach depends entirely on the model.
--
I.S.
_______________________________________________
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