FMDB Wrapper VS Basic data: which is easier to use and maintain?

Memory fragment FMDB VS Basic data: which is easier to use and maintain?

I got confused because FMDB is very old, but many developers use it, while Core Data is new and is only supported by 3.0 and later sdk versions.

Some of them said that FMDB is easy to use and some mentioned basic data. Please help me so that I can go in the right direction.

Thanks at Advance

+7
source share
3 answers

I used both options in a large number of projects.

FMDB is very simple, if you know SQL, it can even be quite easy to use. But what you have to do through the application life cycle is how to change the data model:

  • Change the data model, usually with something like Base
  • Modify the SQL code to reflect model changes.
  • Modify data objects to reflect model changes.
  • Add code to the application to handle the case when you encounter older databases.

What basic data lead to a life cycle:

  • The data model and objects change with the same action (I'm assuming you are creating data objects with something like a mogenerator ).
  • Simple visualization of the data model.
  • Encourages easier relocation of data models, making you think about inverse relationships.
  • Often, automatic migration is enough to go through a simple change model without having to rebuild the database from scratch.
  • Core Data offers some iCloud integration through NSManagedDocument.

Damn that Core Data puts you through:

  • Deletion sucks because any access to properties in the remote object throws an exception to exclude the program.
  • Access to data with background threads sucks because Core Data makes it complex to work correctly with multiple threads โ€” you cannot, for example, use a data object obtained from the context in one thread in another thread. So much for simple passing objects background threads to work with ...
  • There is so much magic in your data that WHEN everything goes wrong, it will be terribly frustrating, trying to figure out what to do.
  • The basic data seems terribly fragile: everything related to exceptions of excluded objects, the use of incorrect exceptions from a stream, exceptions to exclude exceptions, or a complete model disappearing after what seemed like a simple change are all possibilities.

So what would I recommend? To paraphrase an old quote about democracy, Core Data is the worst data storage system - with the exception of everyone else. Even with the new definition of pain and suffering that Core Data brings to your life, working and working is still easier than FMDB or other levels of data storage.

FMDB is simpler, and if you're fine, add a lot of time to change and define a data model, which might be fine. But overall, I would recommend people bite a bullet and use Core Data if there is no clear reason not to.

A few quick tips:

  • Never delete anything in Core Data while the user interface is down and possibly access to objects.
  • If it is possible to consider the database as one-time and be able to rebuild the content, so if the automation does not work, the user can still run the application.
  • Keep the activity of the master data in the main stream and add only the background as a last resort.
  • Under no circumstances should you use master data validations or never clear the "optional" fore field in your entities. Which would you prefer, a bad value gliding across your model that might seem funny or the app just crashes?
  • Use mogenerator to create data objects from your model. It displays objects that are directly attached to the model that the generation can change, and a layer of objects of the "above" type, which starts empty, but into which you can add your own logic around data objects and will not be changed when restoring lower objects.
+19
source

If you do not have specific project requirements, I would use Core Data. Apple is constantly improving it and optimizing it for the iPhone.

0
source

The FMDB Wrapper utility is easier to configure (you can simply add data to your sqlite-db through the FireFox SQLitemanager plugin or use another SQLITE MANAGER to populate your database), itโ€™s easier to debug (you can actually see in real time what is changing in your database) , easier to understand, easier to learn, easier to transfer (to the Internet or Android). Core Data is a poorly designed, poorly implemented, poorly documented superintuitive giant clyde.

0
source

All Articles