Re: dual controllers
Re: dual controllers
- Subject: Re: dual controllers
- From: Hoshi Takanori <email@hidden>
- Date: Tue, 15 Oct 2002 16:00:19 +0900
Hello,
Brian E. Howard wrote:
>
Aaron Hillegass on page 128 of his Cocoa book says: "Here ares some
>
reasons that you might want to create a custom subclass of
>
NSWindowController." The second item he mentions is:
>
>
"You want to put the UI controller logic and model controller logic
>
into separate classes."
You don't need to subclass all of them from NSWindowController.
Instead, you would want one NSWindowController subclass for each
window, and make other controllers subclasses of other class(es).
>
I am trying to decouple as much of my program as possible and
>
separating model and view logic into different controllers seems like a
>
good idea, but I have not been able to figure out how to do it, or find
>
any discussion on the topic. Perhaps it is so simple that no one has
>
bothered to explain it. For a smart guy I can be awfully dense at
>
times.
I think NSDocument subclass is a "model controller", and
NSWindowController subclass a "view controller". Therefore,
having a subclass of NSWindowController is already decoupling
model and view logic.
You may want to divide the model controller or the view controller
into smaller classes, if your model or view logic is complicated.
And, with my rather short experience, decoupling should be done
in early stage; otherwise you'll have a spaghetti NSDocument
subclass, and take more time to fix it...
hoshi
_______________________________________________
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.