Data Management in OS X

Core Data provides a flexible and powerful data model framework for building well-factored Cocoa applications based on the Model-View-Controller (MVC) pattern.

Core Data lets you quickly define your application’s data model in a graphical way and easily access it from your code. It provides an infrastructure to deal with common functionality such as save, restore, undo and redo, allowing you to get on with the task of building innovation into your application. Because Core Data uses the built-in SQLite data library there is no need to install a separate database system.

Core Data

Core Data provides a general-purpose data management solution developed to handle the data model needs of every kind of application, large or small. You can build anything from a contact-management application to a vector-art illustration program on top of it. The sky is the limit. Almost any application that manages data objects can benefit by using Core Data.

Interface Builder, Apple’s graphical user interface editor, provides pre-built Core Data controller objects that eliminate the need for much of the glue code between your application’s user interface and its data model. You don’t have to worry about SQL syntax. You don’t have to maintain logic trees to track user behavior. You don’t have to create a new persistence mechanism. It’s all done for you, when you wire your application’s user interface to its Core Data model.

Core Data organizes your application’s model layer into a set of defined in-memory data objects. Core Data tracks changes to these objects and can reverse those changes on demand, such as when a user performs an undo command. Then, when it is time to save changes to your application’s data, Core Data takes care of archiving the objects to a persistent store. And, it saves data into regular files that users can manage with the Finder, search with Spotlight, backup to CD, and email to friends and family.

Using the Core Data framework, you create a managed object model that provides an abstract definition of the model objects, known as entities, used by your application. This entity-relationship model is defined using Xcode’s Data Model Design tool, which provides a rich environment to model entities as well as their relationships. It serves as a blueprint for your application’s data types and the relationships between them.

SQLite

OS X includes the popular SQLite library, a lightweight yet powerful relational database engine that is easily embedded into an application. Used in countless applications across many platforms, SQLite is considered a de facto industry standard for lightweight embedded SQL database programming. Unlike the object-oriented Core Data framework, SQLite uses a procedural, SQL-focused API to manipulate the data tables directly.

HTML5 Client-Side Data Storage in Safari

Safari, the world’s most innovative browser, supports the latest HTML5 offline data storage features. The offline storage feature enables any web app to store session data locally in the Mac’s browser cache, using either a simple key/value data API, or a more advanced SQL interface. The data is persistent among Safari launches, meaning apps start up faster, are less dependent upon the network, and perform better than ever before. View Safari Technology Demo