View Single Post
Codemonkey's Avatar Codemonkey Codemonkey is online now Super Moderator 2008-04-23 #216 Old  
Going on the information you provided:

You're right, each component would have its own MVC model. All Flash components actually have this, although a slightly different variant (where the controller/view is merged).

To keep things simple (relatively) between multiple components and a central templating mvc system, I probably wouldn't bother trying to keep track of the template model in the component controller or some other coupling like that. Instead, I would probably have the component controller registered as simple listener to the template model and have neutral 'events' like styleChange.

If you are still going the coupled model way (template/component), that's fine, just use the template controller inside the component controller. Remember, the controller is the operator of the machine (model). Since the component itself is somewhat of an observer of the template model like a view, it would propagate action's to the template model's controller. Talking from operator to operator so to speak. Have each controller operate on their own level: component controller on component management and template controller on template system management.

But as I said, I probably wouldn't do that, since that means the component controller needs to have knowledge of the templating's operation manager, the controller. With a neutral event based updating mechanism, I'd use simple listeners (both ways perhaps) to keep things decoupled and clean and simple. Doing this would also mean you could use the component completely outside of the templating system, using the right events.

I hope that made some sense.
Reply With Quote