Re: NSDocuments without window associations
Re: NSDocuments without window associations
- Subject: Re: NSDocuments without window associations
- From: Bill Cheeseman <email@hidden>
- Date: Tue, 05 Nov 2002 07:48:57 -0500
on 02-11-04 10:10 PM, James DiPalma at email@hidden wrote:
>
How to implement a model class? A simple start would be subclassing
>
NSDocument with a class that:
>
- has an instance variable for a model object
>
- alloc/inits a model during its init method
>
- forwards all file i/o calls to this model instance
The book version of my Vermont Recipes Web site (URL below) spells all this
out with example code. For that matter, if I recall correctly, the Web site
does, too. The book will be out in the next few weeks (officially Nov. 12),
and the Web site's sample recipes will be updated at about the same time.
My NSDocument subclass is extremely short. All of the application's data and
data behaviors are in a bunch of much more complex model classes subclassed
from NSObject.
Neither the NSDocument subclass nor the model classes have any reference
whatever to the application's window controller. All communications to the
controller are via notifications, which the controller registers to observe.
This makes the model classes very independent and reusable.
As far as I know, this is a pretty standard Cocoa document-based application
architecture.
--
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
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.