MVC Design Pattern in Web Application Development

MVC was introduced to software development before the World Wide Web came along. In his early days, MVC was a design to easily implement complex GUI applications. First created in Smalltalk, the major feature of MVC’s was that the View would be notified automatically of all changes to the Model.

More recently, MVC has been used on the web, even though the View is in the browser and cannot be automatically updated when the Model changes in the web tier. Our focus is entirely on the web version of MVC.

The MVC pattern is equipped with providing a separation of layers or tiers that applies well to web applications. Separation of layers enables developers to manage the complex components of gigantic software systems by dividing them into high-level components. The MVC design pattern divides web application into three separate tiers: model, view, and controller.

The Controller is out front and is the key component to act in the processing. The controller’s job is to map requests to actions. In a web application, the incoming clients HTTP requests from the browser can be thought of as commands that the user issues to the application. One of the key concerns of a web application is routing these requests to the required set of actions that needs to be taken within the application itself. This controller’s work is very similar to a traffic cop or air traffic controller. In other words, controller’s job is totally administrative.

The Model is a black box that contains the guts of the application. The model represents the states and act as an entity in itself. In software development notation, the model is the internal state of the application. The state consists of both the data model and the business logic. From the high-level view, the data and the business logic merge together to form the state of the application. For example, if we want to log into an application, both business logic and data from the DB will be involved in the login process. It is very likely, that the authentication method is provided by the business logic that will use the username and password and verify them against some persisted data from the database. In this case, the data and the business logic comprises together to form either a “authenticated” state or a “unauthenticated” state .Neither the data on its own, nor the business logic on its own, can produce these states. In simple terms, Model holds the real business logic and the state which knows the rules for getting and updating state.

The View is the presentation component of the MVC pattern; it’s the result which is returns as a page to the web browser. This page is the user interface that presents a representation of the application’s state to the user. These are commonly JSP pages, ASPX or other presentation-layer technology. While there are plenty of options for the view, the job of the view is very clear, it translates the state of the application into a visual presentation with which the client would interact..

  Modified On May-02-2020 02:43:28 AM

Leave Comment