Asp.NET MVC is MVC or MVP?
As I've been reading this article: http://www.codeproject.com/Articles/42830/Model-View-Controller-Model-View-Presenter-and-Mod, MVC was explained like this:
In this diagram, View-Model is observer pattern where any changes in Model notify View's
Update method to update the states of Views and passing its current state to these Views.
Relation between Views and Controllers are defined in Strategy Pattern where Views get concrete controllers and run the algorithms in controllers as defined by Strategy Pattern.
So Controllers update models and models notifies views to update their states.
However, for some reason I couldn't visualize the same logic for Asp.Net MVC as Controllers have access to Model and pass these models to Views but views uses Models directly to get their properties,etc to update their states but I couldn't fit the observer pattern between Views and Models in Asp.Net MVC.
Could some one please explain what I am missing out?
ASP.NET MVC upholds the stateless nature of the web, so once a view is rendered there is no way for the controller to know about changes to an instance of a model object.
This is different to a stateful platform like Silverlight or WPF. The fact that they're stateful allows a controller (or ViewModel if you're using MVVM) to observe what's happening on the UI, make changes to model objects, and then have the view update itself accordingly.
In ASP.NET MVC when data gets passed from the controller to the view, it's a one-way trip. There's no equivalent of the View.Update() method; the view gets rendered once and then that's it. There's also no way for a view to call back to a controller, as per Controller.AlgorithmInterface. You can achieve something similar with an AJAX callback but then you'll have to use some behind-the-scenes magic to repopulate the controller with the state data (e.g. by passing an object ID from the view back to the controller).