• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSDocument as controller vs. as model
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • RE: NSDocument as controller vs. as model
      • From: Brian Hook <email@hidden>
  • Prev by Date: Re: cocoa-dev digest, Vol 1 #651 - 14 msgs
  • Next by Date: Re: Notifications vs. messaging
  • Previous by thread: Re: NSDocument as controller vs. as model
  • Next by thread: RE: NSDocument as controller vs. as model
  • Index(es):
    • Date
    • Thread