views:

68

answers:

2

Hi all,

I'm coming from a Ruby on Rails environment and I'm really spoiled with Active Record there. I did a small proof of concept project using sqlite on the iPhone and I realize even more how much I'm spoiled ;)

For the next application I consider using Core Data (as I believe the way it works will be close to Active Record). My App will provide the user with a lot of data to use (with many related tables) and I intend to update that data on a regular base (each 2-3 months). With sqlite this would be as simple as downloading an sqlite file, is it also that simple using Core Data ?

A: 

SQLite is a persistent store, Core Data is an object graph. They're not exactly the same thing -- though Core Data can live on top of SQLite.

Really it depends on how much data you're going to be storing, and how often you need to look it up in addition to write it. Your update process is going to be a lot more difficult using Core Data than SQLite, especially if you have a lot of data; however, it may be easier to work with for the common case (small updates, reads), which could offset many of these issues.

jer
+2  A: 

Core Data is very similar to Active Data Record. The primary difference is that Active Data evolved from SQL store into the application objects code whereas Core Data evolved from the application objects towards a variety of stores. More concisely, Active Data does not work without a SQL store but Core Data works fine with no store of any kind.

As such, Core Data real strength lays in modeling complex relationships between objects. The type of persistent store used (if any) is largely irrelevant. Core Data makes it very easy to link complex models to complex computer and human interfaces.

The flip side is that you have to maintain the integrity of the object graph so you can't batch import the persistent store. You download the data, create managed objects and insert them into persistent store. While this seems complex and slow, it is really not especially compared to downloading an entire store whether you need all the data in it or not.

Even if it is more complex, the ease of integrating Core Data into the rest of the app usually pays off.

If you are thinking about writing and maintaining several iOS apps then it would be worth your time to climb Core Data's learning curve.

TechZen
If you ever need to serialize any object, CoreData is definitely the way to go!
Jonathan
Did you mean Active Data or Active Record?
Donal Fellows
Sorry Active Record.
TechZen