2

I'm just learning cocoa (desktop) development, and yes I have read over and over than core data is 95-99% of the time all you need.

BUT, at least at a theoritical level, could someone explain to me the ramifications of using something like fmdb over core data, specifically when it comes to an GUI application that will be using uitableview's to display its data.

Say the application is for a inventory system, storing products.

loyalflow
  • 14,275
  • 27
  • 107
  • 168
  • 1
    possible duplicate of [Core Data vs SQLite 3](http://stackoverflow.com/questions/523482/core-data-vs-sqlite-3) This question has been asked and answered many times. FMDB is just a wrapper around SQLite – Abizern May 16 '13 at 18:30
  • No I think my question isn't the same, I am asking for things like how I will have to handle undo/redo myself, I can or cannot use certain binding techniques, handling the efficient loading of items that core data might do built-in, etc. – loyalflow May 16 '13 at 18:45

1 Answers1

3

The answer is simple, if you have a lot of data handling to be done, go for Core Data.

If you want to manually write SQL queries to store and retrieve data then go for SQL with FMDB wrapper.

FMDB is good when you have less data to be handled and if you prefer to write your own data fetching code.

Let's take your example of inventory system for products. In Core Data, you would create an entity called `Product. And Core Data would be responsible for handling all data saving and fetching of a particular entity. And whenever you add a new attribute to the "product", Core Data would handle it for you.

Now, the ramifications if you were to use FMDB, then you would have to write code to save & retrieve from the database. And, whenever you will make changes to the database structure, then you will have to manually add/remove code for the schema changes.

Here are a few good links for Core Data:

http://www.raywenderlich.com/934/core-data-on-ios-5-tutorial-getting-started

http://nachbaur.com/blog/smarter-core-data

Good Luck

Ravi Raman
  • 1,070
  • 9
  • 16
  • I thought that if you make a schema change with core data, it gets messy as you have to re-import the data etc? – loyalflow May 17 '13 at 14:04
  • 2
    There are migrations. They come in two flavors, lightweight and normal one. https://developer.apple.com/library/ios/#documentation/cocoa/Conceptual/CoreDataVersioning/Articles/Introduction.html A lot of changes fall into lightweight migration, meaning core data will be able to figure out how to adjust the underlying database. In case of heavy changes, yes you do have to write migration code, but you would too, in the the plain SQL. Worse case scenario you can just delete the underlying store if the data isn't that valuable. – foFox May 17 '13 at 14:42