When to use Core Data?

by Joshua Scott Emmons

Core Data (along with Tiger) has been out in the wild for over a year, now. As a result, most of the whys? and hows? of CD have been answered at great length in mailing lists and updated documentation. A question that still gets asked on a fairly regular basis, though, is when? When should I use Core Data in my application?

The flip answer is, "Whenever you can!" Core Data is an incredibly powerful technology that crosses "Model" off the MVC list of Things Programmers Worry About. Unfortunately, not every program is a good fit with CD, and sometimes trying to wedge an inappropriate app into the CD mold can cause more complexity than it banishes. So how do you know if your app is a good candidate for CD use? Your answers to the following three questions will let you know.


Sanjay Samani
2006-05-08 07:14:52
Re: Sorting your own Index with CD

You don't have to actually convert the data yourself into an NSArray. If you use NSArrayController and use Sort Descriptors, the sorting is handled nicely. The real difficulty is maintaining your index ordering when you use copy / paste or drag and drop. In your example, if you had a panel with your layers and the user want to use drag and drop to change the ordering, the code to maintain the index can be a pain, particularly if you're allowing multiple layers to be selected for the drag and drop.

2006-05-08 10:50:02
> If your app needs to target 10.3, 10.2, or any earlier version of OS X, CD isn't for you. End of story.

Which pretty much rules it out for any company except Apple.

Josuha Scott Emmons
2006-05-08 13:34:23
Which pretty much rules it out for any company except Apple.

I'm not so sure. Mac users are much more likely to keep up to date with software than your average computer user. The fact that the hardware requirements for Tiger are modest (a G3 and 256Mb of RAM) helps reenforce this.

While not exactly scientific, it is still educational to look at Omni Group's user stats. Tiger looks like it's enjoying a pretty healthy audience.

William Jon Shipley
2006-05-08 14:49:44
Which pretty much rules it out for any company except Apple.

Delicious Library 2 is CoreData all the way. You want it faster AND able to handle more items? You got it!

2006-05-09 09:28:36
Have you ever used a program that did not have an "Undo"? Remember the mild/major frustration there? That's a big fat plus for Core Data.
2007-11-25 14:28:11
TrailRunner uses CoreData too. Without CoreData, TrailRunner would have less then half the features because I still would search for bugs in my own persistency code..