The MVC Programming Model

ASP.NET MVC is a framework for building web applications using a MVC (Model View Controller) design
  • The Model represents the application core (business layer).
  • The View displays the data (the display layer).
  • The Controller handles the input (input control).
The ASP.NET MVC framework is a lightweight, highly testable presentation framework that (as with Web Forms-based applications) is integrated with existing ASP.NET features, such as Master Pages and Membership–Based Authentication. The MVC framework is defined in the System.Web.Mvc namespace.

The MVC model also provides full control over HTML, CSS, and JavaScript.

The MVC model defines web applications with 3 logical layers:
  • The business layer (Model logic)
  • The display layer (View logic)
  • The input control (Controller logic)

Model objects are the parts of the application that implement the logic for the application's data domain. Often, model objects retrieve data (and store data) from a database.

Views are the parts of the application that handles the display of the data (User Interface). Most often the views are created from the model data. The view in MVC in dumb. It just receives data.

Controller is the part of the application that handles user interaction. Typically controllers read data from a view, control user input, and send input data to the model.

In an MVC application, the view only displays information; the controller handles and responds to user input and interaction. The MVC pattern helps us to create applications that separate the different aspects of the application (input logic, business logic, and UI logic), while providing a loose coupling between these elements. The pattern specifies where each kind of logic should be located in the application.

The MVC separation helps you manage complex applications, because you can focus on one aspect a time. For example, you can focus on the view without depending on the business logic. It also makes it easier to test an application. The MVC separation also simplifies group development. Different developers can work on the view, the controller logic, and the business logic in parallel.

No comments:

Post a Comment