I see numerous sites and articles explaining that the view is updated from the model like the example below however i see a few other examples of MVC architecture showing that the view is updated via the controller
Is this depending on whether you have the @Model into your views? im just wondering why the different versions of MVC, we were taught that it should be the second image.
-MVC is an architectural pattern consisting of three parts: Model, View, Controller. Model: Handles data logic. View: It displays the information from the model to the user. Controller: It controls the data flow into a model object and updates the view whenever data changes. -It is invented by Trygve Reenskau.
MVC (Model-View-Controller) is a pattern in software design commonly used to implement user interfaces, data, and controlling logic. It emphasizes a separation between the software's business logic and display. This "separation of concerns" provides for a better division of labor and improved maintenance.
The Model is the part of MVC which implements the domain logic. In simple terms, this logic is used to handle the data passed between the database and the user interface (UI). The Model is known as domain object or domain entity. The domain objects are stored under the Models folder in ASP.NET.
A controller is responsible for controlling the way that a user interacts with an MVC application. A controller contains the flow control logic for an ASP.NET MVC application. A controller determines what response to send back to a user when a user makes a browser request.
MVC is a loosely defined pattern that gives the architect much discretion over implementation details. This is probably why so many variations of MVC exist.
To my knowledge, it all started with Classic (Original) MVC that separate web application into three parts i.e. Model, View and Controller. The objectives were:
The pattern charmed so many that there were several variations (Active Model, Passive Model, Model2). These variations were due to implementations of the pattern in particular frameworks to suit the frameworks' design goals.
For example, one variation is Model2. Model2 is a web variation (Classic MVC was actually targeted for desktop application) and got popular as "ASP.NET MVC Framework".
The key difference between Classic MVC and ASP.NET MVC Framework is, the later provides a neat separation between Model and View i.e. no direct interaction. Rather Controller is responsible to facilitate this communication between Model and View in ASP.NET MVC Framework. This makes ASP.NET MVC Framework web applications a lot easier & efficient to test.
Furthermore, in Model2 there's a sort of loose contract that can be established between the view and the controller. In the ASP.NET MVC Framework, this contract used to be represented by the ViewData container object and nowadays using a ViewModel object.
To avoid confusion, one need to look at the interactions between these three parts (Model, View & Controller) in the MVC pattern implementations currently in use. Also embrace the fact that it is a particular implementation of MVC pattern and one diagram may not be able to describe it completely.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With