RE: NSDocument as controller vs. as model
RE: NSDocument as controller vs. as model
- Subject: RE: NSDocument as controller vs. as model
- From: Brian Hook <email@hidden>
- Date: Mon, 01 Oct 2001 11:07:28 -0700
- Organization: Pyrogon, Inc.
>
[mailto:email@hidden] On Behalf Of Bill Cheeseman
>
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.
That's pretty much what I thought. So in reality, the MVC paradigm
expands into:
application delegate (the "meta controller"?)
document controller controller (NSDocumentController...ugh, the
nomenclature is ghastly)
document controller (NSDocument)
document/model (app specific)
window controller (NSWindowController or subclass)
windows (NSWindow/Panel/etc.)
Then you would typically have a MainMenu.nib with no window, just the
application's delegate as File's Owner (?). Then auxiliary NIBs will
store specific windows and their various controllers, e.g. a
Document.nib that would have a document window and an NSDocument as the
File's Owner?
Does this sound right? Sorry if I'm sounding confused, but this is a
lot of information to grasp at once, especially for those of us crippled
with a C++/MFC background =)
Brian