Skip navigation.
 
mlRe: MVC paradigm: multiple controllers?
FROM : Scott Stevenson
DATE : Tue Oct 05 23:31:10 2004

On Oct 5, 2004, at 12:51 PM, Keith Blount wrote:

> For instance, like I say, I have a table view that shows some of the
> same data as an outline view (much like in Xcode) - should they both
> use the same controller? If not, how can they both access the same
> data? Surely the data class has to be instantiated in only one place?
> But if they should use the same controller, then it will get pretty
> long and unmanageable when all the delegate methods for the outline
> view and the table view are implemented along with all of the saving
> and opening of documents etc.


I'm not sure there's any hard and fast rule for every situation you've
described. For the most part, though, I think people feel each separate
window should have an NSWindowController subclass managing it.

In terms of keeping things in sync, don't overlook bindings or
key-value observing. NSOutlineView doesn't support direct bindings in
interface builder yet, but you can use *manual* (aka 'programmatic')
bindings to sync the underlying data between your various controllers.

Also, when your classes get long and unwieldy, don't foget about
categories! They are fantastic for breaking up very long classes into
manageble, bite-size chunks.


    - Scott



--
http://treehouseideas.com/
http://theobroma.treehouseideas.com/ [blog]

Related mailsAuthorDate
mlMVC paradigm: multiple controllers? Keith Blount Oct 3, 01:42
mlRe: MVC paradigm: multiple controllers? J Tichenor Oct 3, 07:19
mlRe: MVC paradigm: multiple controllers? Keith Blount Oct 5, 21:51
mlRe: MVC paradigm: multiple controllers? J Tichenor Oct 5, 22:11
mlRe: MVC paradigm: multiple controllers? Scott Stevenson Oct 5, 23:23
mlRe: MVC paradigm: multiple controllers? Scott Stevenson Oct 5, 23:31
mlRe: MVC paradigm: multiple controllers? Keith Blount Oct 6, 20:25