views:

191

answers:

1

Hi there,

I'm experimenting with Core Data, plist files, flat files and sqlite. I can't seem to differentiate in terms of efficiency for small data sets. In terms of the differences on the surface ( i.e the API ), i know the difference.

But what I'm trying to get a feel for is which persistence model is best for which situation.

Thank you.

+2  A: 

For small data sets, if you need read - write capability, you should go with NSUserDefaults - if gives you the power of key-value store and retrieval without too much hassle.

If you need read-only access, plist files are a viable option, as it keeps the abstraction to the concept of key-value and offers an accessible API to work with.

Flat files would be recommended if you need a different model of persistence than key-value, otherwise it would mean just reinventing the wheel.

Sqlite would fit the case where your data is organized in a strong relational manner and instead of key-value, you'd rather prefer having the power of sql to work directly with your data.

If for your dataset, however small it may be, would be an unnecessary inconvenience to manage the low-level storage and retrieval, then you could choose CoreData. With CoreData, code can retrieve and manipulate data on a purely object level without having to worry about the details of storage and retrieval, so you'd be more focused on your domain logic rather than fitting it to the storage and data manipulation logic.

luvieere