Cocoa scripting, Cocoa bindings, and Core Data are three development technologies available in Mac OS X that rely on key-value coding:
Cocoa scripting, described throughout this document, provides support for creating scriptable applications.
The Core Data framework provides generalized and automated solutions to common tasks associated with object life-cycle and object graph management, including persistence. It is described in detail in Core Data Programming Guide.
Cocoa bindings provides a means of keeping model and view values synchronized, without having to write a lot of "glue code," such that a change in one is reflected in the other. It is described in detail in Cocoa Bindings Programming Topics.
As noted, all three of these technologies rely on KVC, so you will gain by making your application KVC-compliant. Cocoa bindings and Core Data also make use of key-value observing, but Cocoa scripting does not.
While these technologies are not closely tied together, here are some rules of thumb that may aid in combining their use:
Core Data and Cocoa bindings: These technologies neither aid nor interfere with each other, so you can mix them as needed for your application.
Core Data and Cocoa scripting: Because Cocoa scripting deals in ordered to-many relationships, and Core Data deals in unordered to-many relationships, you must do extra work to expose the to-many relationships of your managed objects as scriptable element classes. For each managed-object to-many relationship that you want to make scriptable, you can add an unmanaged, derived, to-many relationship solely for access by Cocoa scripting. For information about how to implement these derived to-many relationships, see "Indexed Accessor Patterns for To-Many Properties" in Key-Value Coding Accessor Methods in Key-Value Coding Programming Guide and “Getting and Setting Properties and Elements” in this document.
Cocoa scripting and Cocoa bindings: Again, these technologies neither aid nor interfere with each other. If you're using bindings but not Core Data, you probably have ordered relationships, which will work with Cocoa scripting.
For related information, see “Interaction With Key-Value Observing.”
Last updated: 2008-03-11