Re: Collections can be simple Attributes in Core Data
site_archiver@lists.apple.com Delivered-To: cocoa-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=AiQMivgXHiPtoeTHFtDJ+yNO6Cx8RNxYTtV7RP1aD8M=; b=M0nSBjLCdaVgp8St4JYudcNPUUKRenzHt8bm6NKfG1RIOLf9X56Vwa4Vhhgt9UfdqT yZsFtQ/wI58ywvobMYekAv8d2GA+X3Xn4zX1PoWzE5jsohcB8tTVgUugS2swTIWNn1Kz 3ksR8G5DLfRhAc2IlMS4BVleIUaqJOjZcWeAM= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=Cw/kyEOGsrE26YYVNz6nBBg1yCyOtye2Cy6Nm6gmX0oZKoge05pG+yfGK+ULezIj8n kSCQuQQEz/bjgPbf83Ybid9Tvz+R/3LjX+GmtDn5X1A09kp7iDDhLqzfGT0v4niQEuoG Lug9EOhLSv3RxtmXESXc5JBjBwci+or0lPTjU= On Mon, Sep 29, 2008 at 3:03 AM, Negm-Awad Amin <negm-awad@cocoading.de> 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 (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/site_archiver%40lists.apple... This email sent to site_archiver@lists.apple.com
participants (1)
-
I. Savant