Re: NSDocument-based app limitations?
Re: NSDocument-based app limitations?
- Subject: Re: NSDocument-based app limitations?
- From: mmalcolm crawford <email@hidden>
- Date: Tue, 30 Mar 2004 00:51:20 -0800
On Mar 30, 2004, at 12:35 AM, Seth Willits wrote:
I agree. All of the applications I'm interested in writing in Cocoa
are document bases, but I have to find a *clean* example showing a
complex document as compared to a very simple text editor with a
single document type. I've always found Sketch to be a big mass of
code with no explanation. My biggest trouble (and this is probably due
to the fact that I'm simply new to Cocoa altogether) is figuring out
the class structures like: Which pieces of the UI and subsystems
should have their own controllers? Who acts as delegates? Is it the
controllers or specialized objects? Maybe subclasses of the controls
themselves? Stuff like that.
This is largely basic OOAD, leveraging MVC.
As the document architecture documentation makes clear, the NSDocument
subclass typically serves as the controller object, mediating between
the views in the window and the model. Even a fairly cursory
inspection of Sketch (in particular the nib fies) should reveal what
are the major players and what roles they take on.
The MVC architecture is extensible, however, now in two ways. Firstly,
using the "original" document architecture, through the use of
NSWindowControllers, which allow for multiple views of the same data.
Secondly, through the new NSController classes with Cocoa Bindings, in
which reusable controller objects are able to take control of different
aspects of the UI pertaining to individual model objects, or
collections of model objects. Some developers followed a similar
approach prior to the introduction of bindings.
The NSDocument subclass seems to be referred to as the all-purpose 409
of the application, but that doesn't seem right. I could see an entire
book being written on the thought and design of a document-based
application, yet no one has even a tutorial remotely more complex than
"let's build a text editor!" or Sketch. Maybe I'm asking for the
world, but that's what I'd like to see.
Some somewhat relevant references:
<
http://homepage.mac.com/mmalc/CocoaExamples/controllers.html>
<
http://cocoa.mamasam.com/COCOADEV/2004/01/2/82162.php>
mmalc
_______________________________________________
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.