Re: The more I read about MVC, the more confused I get...
Re: The more I read about MVC, the more confused I get...
- Subject: Re: The more I read about MVC, the more confused I get...
- From: Scott Andrew <email@hidden>
- Date: Thu, 12 Jun 2003 19:53:06 -0700
On Thursday, June 12, 2003, at 07:01 PM, Brent Gulanowski wrote:
Hrm, not sure I understand this one clearly. Unless you are filling
the pop-ups programmatically and dynamically, wouldn't it be better to
just set them up in IB? Otherwise, if the dictionaries aren't part of
the model, then a view controller should own them, I believe. The rest
would be standard target-action stuff. The view should be very stupid
about anything but itself. It is there to present controls, but it
doesn't know what those controls mean, only how to report that the
user has interacted with them, and what state they are in. The view
controller retrieves that state information, and passes it onto the
document in a format more suitable to the model. Then the document
updates the model, because it knows the details of the model's
interface.
For single-window apps, this division of the controller into two
layers can be considered optional. Even if you don't make custom
window controllers, the document controller will, but you don't have
to know they are there. Your controls and views can talk directly to
the document. Because controllers are mostly just collections of
methods, with little or no state, the locations of those methods is
partly a matter of being organized, although changes to the view will
necessitate changes to the view controller, so it is good to have it
de-coupled from the document logic.
I am a newbie planning a project and have some questions along the same
lines:
Ok I have this question. I am working on a small graphics app that
takes a bunch of media displays them for the user to to layout then
spits out a package. I have my heirarchy setup so that i have a few
different media types TBMedia is the parent it just holds a path, a
rect, and some simple commands. Then children there are children of
TBMovie, TBImage, TBText. I have a TBDataModel that knows how to open
my packages and translate them to the proper classes, it is also used
to import images and create the proper object. The controller also has
the order they are layered. Also it is used to make sense of the media
heirarchy's and spit out my dictionary of media and positions. If each
of these types has a view assocaited with them, would the media types
be considered my controllers? Each media type has properties that are
associated with them that can be modified using a sheet similar to
Interface Builder.
My thought is a user selects the view associated with an item the
TBMedia class get's notified it has changed its state and tells the
window controller a selection has changed via a message. Also
registered with this message is the property dialog that will switch
its context. My data model is to handle things like media import and
and creation of media. The window controller tells everyone else
someone has taken selection and to do the proper thing.
Oh yea i am using the views to make use of the transparency.. i could
just basically draw things in the proper order in the same view as
well. My movie is painted by hand so i can layer things on top and
under it, so it requires a QuickDrawView. My other thoughts about
using views is that it would be easier to hit test, drag things around,
and manage state. But does it bog down the system if you get too many?
I am talking about 30 layers per document. So each object gets its own
view.
Does this make sense?
_______________________________________________
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.