Re: NSDocument as controller vs. as model
Re: NSDocument as controller vs. as model
- Subject: Re: NSDocument as controller vs. as model
- From: Bill Cheeseman <email@hidden>
- Date: Mon, 01 Oct 2001 05:11:04 -0400
on 10/1/01 2:48 AM, Brian Hook at email@hidden wrote:
>
I've seen a couple different examples of a document based application under
>
Cocoa. In some examples I see "NSDocument is the model", whereas in other
>
examples I NSDocument as a controller to the model (model vs.
>
model-controller").
>
>
Is this just a stylistic thing or is one way "more correct than the other"?
Somewhere in the documentation you will see a suggestion that it's OK to use
NSDocument as both model and controller in very simple applications. But if
you anticipate having even a moderately complex or extensive data structure,
my feeling is that it's best to leave NSDocument as a pure controller and
create separate object(s) for your model. It should make extensibility
easier. That's how I did it in Vermont Recipes, and it's working out pretty
well.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
Croquet Club of Vermont -
http://members.valley.net/croquetvermont