Re: Is Core Data appropriate to my task?
Re: Is Core Data appropriate to my task?
- Subject: Re: Is Core Data appropriate to my task?
- From: Erik Buck <email@hidden>
- Date: Thu, 10 Sep 2009 12:21:28 -0700 (PDT)
Yes. Use Core Data. Your application is exactly what Core data is intended to support.
Create a planet entity.
Create a one to many relationship so that each employee has one planet, but each planet has an unlimited number of employees.
This is exactly what "lookup tables" in sql produce. There is no need for fancy fetched properties. There is no problem with having planet entity instances in the same store with employee entity instances. It is a good design that makes your data stores self sufficient. There will only be one instance of the planet entity for each planet that you define. Right now, you would never have more than 8 or 9 planet entity instances no matter how many employee instances you have.
You could also just have a "planet of origin" string property in each Employee entity. The property could default to "Earth". There is no need for a custom "Enum" type when strings work perfectly well. You can even validate the strings whenever they change to restrict the set of valid strings. Constant strings will tend to have the same pointer, so you won't even have the cost of separate string copies for each Employee instance.
_______________________________________________
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