What is an MVC framework?

1,711 Views Updated: 20 Feb 2018
Follow Post
What is an MVC framework?

Design Patterns 

In software development, one of the most important things is the design pattern. There are many situations that repeat themselves in software. We need a common solution for such repeating problems. If we have that, tons of working hours could be saved. 

Otherwise doing the same work over and over again would be the only way. Naturally, that could be suicidal in this agile age. Such common and repeatable solutions to the problems that occur commonly are called design patterns. 

These design patterns give us the tested and proven paradigms of the development of software. A design pattern offers the core of the solution to specific problems, and this solution could be adjusted and adapted as per the finer requirements.

MVC

In plain words, MVC is a software design pattern. It is used to implement user interfaces, data, and processing of data on computers. A user interacts with the computer in some specific way. Be it taking information from the computer or providing information to the computer. 

Internally, the flow, processing, and storage of data are handled in a way different than that of the user interaction with the computer. The MVC framework divides all this phenomenon into three parts namely models, views and controller.

Model

The models are the central part of the framework. The model represents data and does nothing else. Models are independent of the controllers and views.

View

A view is the graphical representation of information. For e.g. a pie chart is a view and so is a form. And naturally, a piece of information can be expressed in different views. The same information can be expressed by a pie chart and also by a bar diagram. 

A view also sends the user actions to the controller. For e.g. it sends the key hits and mouse clicks to the controller. A view can be independent of models and controllers. But in some cases, a view is itself a controller and hence it depends on the models.

Controller

A controller coordinates with the user, models, and views. It interacts with the user, invokes specific models and views by converting those inputs into proper commands for models and views. 

A controller sends commands to a model for updating its status and also to a view to updating it as well. In brief, a controller is an operation being performed on the data. A controller depends on the view and the model.

Available MVC Frameworks

The MVC frameworks are developed for almost all the major web programming languages. In fact, the MVC web frameworks hold the major market share as compared with the non-MVC frameworks. Many are commercial solutions while many others are free. 

Some popular web MVC frameworks are Laravel, Symfony, CodeIgniter, Yii 2, Phalcon, CakePHP, Zend Framework, Backbone.js, AngularJS, Ember.js, Agility.js, etc.

Obviously, there are many differences between how these frameworks work. And one of the chief perspectives of this difference is the division of works between the client and the server.

There are many web frameworks that use the thin client approach. The major part of the responsibilities is placed on the server. The client invokes the controller by using a hyperlink or by sending form data to it and then the model that is right there on the server performs and updates the views. Examples of such MVC frameworks are ASP.NET MVC, Django, and Ruby on Rails.

With the passage of time, the client technologies developed and became capable of handling many MVC responsibilities. Examples are EmberJS, AngularJS, Backbone, and JavaScriptMVC. They allow MVC components to execute partly on the client. So these frameworks use the fat client approach.

Variants

There are some variants of this MVC framework. These are adapted to different concepts and situations. For example, model–view–adapter (MVA), hierarchical model–view–controller (HMVC), model–view–viewmodel (MVVM),model–view–presenter(MVP).

Arrival of MVC

First of all, in the 1970s, MVC was introduced into Smalltalk-76 by Trygve Reenskaug while visiting the Xerox Palo Alto Research Center (PARC). It was just the start. Much work was done by others too in this direction and by 1988 MVC was established as a general concept.

Initially, this framework was started to be used for the desktop applications. But with the passage of time, it has been very popular in the web industry. And it deserves it.

Reusability and manageability

The MVC framework makes the models and possibly views also reusable without modification. The controller breaks the dependency between the models and views. 

As a result, implementation of new features and managing the code become easier. It saves much time, and the developers do not face panic.

Summary 

The MVC framework enhances the reusability and manageability of the code and offers an agile environment of development. Naturally, it is a hit.

vote-icon.png
Posted by: Atul Prakash Posts: (50) Opinions: (1303) Points: 9,505 Rank: 5
0

Related polls