January 2016 ~ MiTechDev.com

Mitechdev.com is a programming blog which focused on Web Programming and development

Friday, 22 January 2016

What is MVC(Model View Controller)

02:06:00 Posted by raviteja swayampu No comments
In this tutorial author explained about what is MVC development model and components of mvc development.

What is MVC

Model View Controller is a Design pattern that is used to solve the development problems which occurs during the development of the web applications.before going to learn about the MVC first we have to know what is the design pattern.

MVC is one of three ASP.NET programming models. MVC is a framework for building web applications using a MVC (Model View Controller) design: The Model represents the application core (for instance a list of database records). The View displays the data (the database records).

What is Design Pattern

Design pattern is a solution for the problems and it is a approach for the better development of application.

Why we need a design pattren

In traditional approach of development the dependency is very high.for example developers need to create database before the front end  development if we make any changes to the front end then database will also be modified.To do any modifications for this applications will be difficult.To overcome this Microsoft introduced MVC approach in 2009.

Features of MVC

The size of the page is smaller compared to the ASP.NET webpage size.
1.The main advantage of mvc is SOC(separation of concern).
2.Easy routing.
3.More convenient to the client  side frameworks like jquery,Angular js and etc.
4.Increased performance.
5.Concurrent development.
6.Code management is very easy for applications.

Architecture of the asp.net mvc is as shown in below picture,

Lets see the categories in detail


Model is the part of the application that handles the logic for the application data.Often model objects retrieve data (and store data) from a database.Most often the views are created from the model data.
Typically controllers read data from a view, control user input, and send input data to the model.

Note: the extension of the model file '.cs'.models are nothing but class files that commonly contains the auto implemented properties.


View is the parts of the application that handles the display of the data.View are implemented by using plane html.And Microsoft also provides some "Html helpers" to simplify the view development.Later we will discuss about the helpers in another lesson.

Note: file extension is ".cshtml".


Controller is the part of the application that handles user interaction (handles the requests from the user).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.

Note: file extension is:".cs".In MVC to differentiate the other class files controller class is prefixed with the word "Controller".

I hope this article helps you to understand basics of asp.net mvc and design pattern...