Reputation: 3320
Is the MVC pattern implementation in Asp.net Mvc not using the observer pattern?
Most definitions I've seen for the MVC pattern (like in the gang of four book or in Wikipedia) state that the model "notifies" the associated views about changes. However, I believe this is not how it works in Asp.net Mvc. Is this correct?
I'm asking out of curiosity as I've finished an MVC proof of concept for a desktop app, where it's natural to implement events on the model and have views listening to these events for changes.
Upvotes: 2
Views: 289
Reputation: 12555
The short answer is, no, it doesn't implement the observer pattern. This is because of the stateless nature of the HTTP protocol. When a model in the server modifies its state for some reason, the clients (browsers for example) would never get a notification for this update unless you ask the server again for changes. In desktop application the case is diferent since views (components) are notified about changes in the observed model.
Upvotes: 1