Main problem that I see with the code that was posted is that it breaks
a major MVC rule and teaches a real bad habit: Views shouldn't have any
knowledge of Models

Not sure where you get the idea that a View shouldn't communictate with the 
Model directly:

This states otherwise: 
http://st-www.cs.illinois.edu/users/smarch/st-docs/mvc.html

<quote>
Unlike the model, which may be loosely connected to multiple MVC triads, Each view is associated with a unique controller and vice versa. Instance variables in each maintain this tight coupling. A view's instance variable controller points at its controller, and a controller's instance variable view points at its associated view. And, because both must communicate with their model, each has an instance variable model which points to the model object. So, although the model is limited to sending self changed:, both the view and the controller can send messages directly to each other and to their model.
</quote>

For those wondering why I quote the above article:
http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller#History

regards,
Muzak


----- Original Message ----- From: <jchilc...@interactivityunlimited.com>
To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
Sent: Thursday, February 16, 2012 3:07 PM
Subject: RE: [Flashcoders] Fwd: MVC


Main problem that I see with the code that was posted is that it breaks
a major MVC rule and teaches a real bad habit: Views shouldn't have any
knowledge of Models and Models shouldn't care who's using them
(Controllers are just conduits between Views and Models). On a larger
scale, this would present itself to be a huge maintenance nightmare and
dependencies have now been created. Everything should be independent of
each other enough that I could replace one section without affecting the
operation of anything else in the application. In this case. the
controller should be passing either Value or Transfer Objects back and
forth between the View and Model. This way, I could change models on the
fly and the controller and view wouldn't suspect a thing.

RobotLegs is an excellent example for learning about MVC.


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to