On May 18, 2005, at 12:12 PM, Bill Bumgarner wrote: If you are mutating models on the fly and you aren't creating an application specifically chartered to be creating models, then your model does not sufficiently describe your application's data.
An application "specifically chartered to be creating models" is called a dynamic language runtime. The Objective-C runtime is not flexible enough to allow model modifications at runtime, since by design, Objective-C models are meant to be built using the Objective-C class system, and these classes can only be loaded but not unloaded at runtime. This is a real though by no means fatal limitation of the Objective-C runtime. As long as one resigns oneself to stopping the application and loading the new model and migrating old user data when updating. Indeed, this is how most Mac applications have traditionally dealt with upgrades (the notable exceptions being lisp and smalltalk based applications where significant changes can be loaded into a running application without requiring a restart).
I think your view rests heavily on a distinction between development and deployment: "the model should not change frequently outside of the development environment." However, with a truly dynamic language, one can continue to do development (such as modifying existing classes which have already been instantiated and having these existing instances reflect the newly loaded class definitions) in a deployed application. The development/deployment distinction is one that only applies to languages whose runtime do not allow the sort of dynamism I've referred to here. This sort of dynamism is not supported by the Objective-C runtime, which is why developers used to Objective-C think of the process as being separated into development and deployment stages.
Given this (slight) limitation, it only makes sense to treat model changes as something that will require an application restart and some data migration. My reading of the CoreData docs leads me to believe that it was intended to be used in this way - model changes will require a recompilation and restart of the application, with the attendant data migration.
regards
|