views:

1407

answers:

6

From now on should one use core data as a wrapper for a small iphone app with an sqlite single table database?

Does it unnecessarily complicate things or is it good practice to use from now on?

A: 

I guess it really depends on the application you're trying to build. Although SQLite is known for being a "soft/small" database engine, not over-complicating the database structure might be advisable.

fmsf
+1  A: 

If I was building an app from scratch, or making a major revision anyway, then I'd look at Core Data at the same time.

Otherwise, if it ain't broke...

frankodwyer
+8  A: 

Yes I think it is - Core Data is not a complex API - and it provides access to a lot of powerful features.

I had to face the same decision as you - I invested half a day into Core Data and was very glad.

An app that starts as one table is useful can quickly become more and if you don't build on solid foundations you can find you have given yourself a huge headache in the future - just to save some time now.

Yes it is good practice - you will be so grateful for taking the Core Data route.

Grouchal
A: 

Core Data is a framework for building the model component of a model-view-controller (MVC) architecture. As such, its purpose is to manage a graph of object instances and it is, arguably, the best object graph management framework available on any platform. It just so happens, that Core Data is also able to persist this object graph to disk. If you don't care about the exact schema of the data base (or whether exactly how your object model is persisted to disk), you should very carefully consider not using Core Data.

Barry Wark
+1  A: 

I have said this before. Look at just saving you data into a simple PLIST file. I know of a few apps that do this today on the app store and there is nothing wrong with the method.

Basically you can take a NSDictionary object and with a few lines save it as a PLIST or reload its content from a PLIST.

CoreData is great and I am using it in a more complicated app but there is a LOT to learn and I think its more a 3 project than half a day.

John Ballinger
+2  A: 

It's worth it.

  1. Your 1-table model may become more complex in a future version. CoreData has some facilities to handle migration when the underlying model has changed.
  2. It allows you to use NSFetchedResultsController, if you use an UITableView. You almost won't have to code anything persistence-related, and it ensures that you'll never have more objects in memory than you really need for displaying.
  3. It will manage undo for you. For free.

Worth a couple of hours reading the tutorial and reference, IMHO.

fraca7