What is MVC?

MVC stands for Model-View-Controller, a design pattern that’s very popular in the web development space.

There are three pieces to the MVC pattern:

Controller

The Controller processes and responds to user events and actions and invoke changes to the Model and the View based upon those.

Model

The Model comprise functions that interact with the database or perform complex operations (business logic objects).

View

The View provides different ways to present the data received from the model. They may are normally templates that are displayed to the user (presentation – user interface).

Why use MVC?

MVC is a natural fit for web apps. The user makes a request; the app responds by changing it data model and returns a view to the user. It’s a cycle that is very similar to a web page’s life cycle and fit very well together.

Today MVC is used in most modern web and GUI frameworks, such as ASP.NET, PHP, Ruby on Rails, JavaScript and every framework uses MVC somewhat  differently in some fashion, but the basic components and functionality are the same.

MVC

ASP.NET MVC

In ASP.NET, the MVC programming model was introduced in 2009 as an additional .NET library to install. The current MVC 4 library is part of the Visual Studio 2012  development tool, so no additional installation is needed, otherwise you can download the MVC 4 Framework if you are using an older version of Visual Studio.

Reference: http://www.asp.net/mvc

Ruby on Rails MVC

In Ruby on Rails, the MVC architecture is part of the programming model of Ruby on Rails, so there is nothing else to install or download to use.

Reference: http://rubyonrails.org/

PHP MVC

In PHP, which is a proceedural and object-oriented programming language, you will need to use a framework to use the MVC model:

  • CakePHP: This framework takes inspiration from Ruby on Rails and very much belongs to the KISS (keep it simple stupid) camp. 
  • CodeIgniter: This framework only follows MVC loosely as the models are optional but is good for less complex web applications.
  • Symfony: This framework follows strict MVC architecture, has a small footprint is geared towards larger enterprise-level applications.
  • Zend: This framework (started by core developers of PHP) offers commercial products but is loosely coupled and usage of MVC is optional.
  • Yii: This framework is fast, extensible, modular, strictly object oriented and follows pure MVC architecture with no template features to learn.

Leave a Reply

Your email address will not be published. Required fields are marked *