Skip navigation.
 
mlRe: MVC paradigm: multiple controllers?
FROM : J Tichenor
DATE : Tue Oct 05 22:11:19 2004

> Many thanks for your reply. The advice about not
> having too many controllers but at the same time not
> throwing everything into one controller seems sound,
> though a little harder to work out than it sounds!
>
> Notifications seem a good way to go, but I'm still a
> little confused about how - or whether - to split up
> controllers that deal with the same data. 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.
>


All I am doing, when my mainController notified my other controllers,
is sending the chosen object out and letting each controller deal with
displaying as they see fit. Remember, you instantiate your data object
in one controller and then pass pointers to that instance for the other
controllers to work with. At least that's how I'm building and so far
so good.

I have as many controllers as I have major views in my app -- one
mainController and one each for major tabViews. I will also create a
controller for a major information/preferences panel. Again, I am new
and learning so don't know if this is right or wrong -- just what works
in my brain at the moment.

> Is there a good tutorial on controller management
> anywhere? Most tutorials and examples in books deal
> with simple programs that can happily use one
> controller; I would really like to read something
> about using and splitting up controllers effecively in
> a large program.
>


No, I haven't found any multi controller tutorials - maybe on
macdevcenter...?

J

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