Re: MVC paradigm: multiple controllers?
Re: MVC paradigm: multiple controllers?
- Subject: Re: MVC paradigm: multiple controllers?
- From: J Tichenor <email@hidden>
- Date: Tue, 5 Oct 2004 21:11:19 +0100
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
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden