Re: Suggestions Please - Lookup Lists in Core Data
Re: Suggestions Please - Lookup Lists in Core Data
- Subject: Re: Suggestions Please - Lookup Lists in Core Data
- From: Keary Suska <email@hidden>
- Date: Sun, 04 Nov 2012 07:55:12 -0700
On Nov 4, 2012, at 12:50 AM, Rick Aurbach wrote:
> In my Core Data data model, I have four different entities, each of which implement a lookup list. That is, the entity has one attribute (a name string) and a relationship pointing to all of the other objects which use that particular term.
>
> I am considering two different ways of implementing these lookup lists - either as four separate (and independent) entities or as a single entity (with an additional attribute which is the lookup-list-type).
>
> Which approach is better and why do you think so?
>
> On the one hand, I can see advantages to having one lookup-list entity in the data model vs. four, both in terms of the complexity of the data model and in storage efficiency. On the other hand, while the extra coding cost of a single list is modest (a slightly more complicated predicate, since I always have to specify the list-type attribute in any fetch request), there are bound to be some increased processing costs.
Although I don't know that either approach is better, per se, but I personally lean toward keeping them separate as:
1. combining all lookups into a single entity will exchange model complexity for code complexity;
2. if there is a potential for the combined lookups to contain significantly large number that you could run into performance issues when traversing relationships. Especially considering that Code Data will often want to load the entire entity even if the "type" you are dealing with has only a few objects;
3. separate entities allow the model to be self-documenting.
HTH,
Keary Suska
Esoteritech, Inc.
_______________________________________________
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