17th May 2010 at 03:53pm

iPhone ORM Backend

While writing the iPhone app for mytours, I have swapped out the backend ORM 3 times. This was due to starting the project just before version 3 of the iPhone SDK was released, so googling for suggestions for a starting out iPhone dev at the time was yielding dated results.

Started with activerecord for objective-c. results: hard to set up, not very flexible. You have to manually set up an sqlite database to match your implementation.

After about 6 months, we moved to sqlitepersistenceobjects. This was a far easier to use library, that was flexible, generated its own sqlite database, and was easy to swap out in place of activerecord. The only problem with this library is that the loading of objects was over the top greedy, resulting in poor performance.

Finally, after finally getting around to addressing the performance, a new look at what the best persistance solution for the iPhone is, found that Apple had included the CoreData framework into version 3 of the iPhone SDK.

CoreData easily replaced sqlitepersistenceobjects, and the results were instantly noticeable. lazy loading of data resulted in the entire app speeding up.

So for anyone starting out, CoreData is the way to go:

  • Easy setup!
  • Persistence is 100% handled by the framework (no messing around with sqlite)
  • choice of persistence (sqlite/xml/implement your own)
  • performance tuned and heaps of functionality.
  • Both the previous libraries I mentioned are no longer maintained due to CoreData totally trumping them on everything. Why didn’t apple include CoreData from the start?
Add Comment: Sign-in-with-twitter-darker

All comments

none!