You are on page 1of 3

M-Model, V-View, C-Controller Basics

What is MVC?
* The 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.



* Model View Controller is a design pattern. This design pattern has been present in software
applications for several decades.
* The Model View Controller pattern was invented in a Smalltalk context for decoupling the
graphical interface of an application from the code that actually does the work.
* Model-Consist of Application data and the business rules. It contains the code to manipulate
the data (From Database or any data source) & Also the Objects that retrieve the data. It
represents the state of particular aspect of the application. Eg Model Maps to Database Table
and entries in table represent the state of the application. Model is responsible for actual data
processing, like database connection, querying database, implementing business rules etc. It
feeds data to the view without worrying about the actual formatting and look and feel.
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.
* Controller- Handles user iteration, Reads data from view, Controls Input & Send input data to
the model. Handles Inputs and update the model to reflect the change in state of
the application. It also passes information to the view. Controller is responsible for Notice of
action. Controller responds to the mouse or keyboard input to command model and view to
change. Controllers are associated with views. User interaction triggers the events to change the
model, which in turn calls some methods of model to update its state to notify other registered
views to refresh their display.

The View is the parts of the application that handles the display of the data.
Most often the views are created from the model data.
* View-Is an output, It could be a webpage or a printout. In short views are used to display the
data. Most of the time we create views from the model data. It accepts information from
the controller and displays it. View is the graphical data presentation (outputting) irrespective of
the real data processing. View is the responsible for look and feel, some custom formatting,
sorting etc. View is completely isolated from actual complex data operations.
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.
Why MVC?
The MVC programming model is a lighter alternative to traditional ASP.NET (Web Forms). It
is a lightweight, highly testable framework, integrated with all existing ASP.NET features,
such as Master Pages, Security, and Authentication.
MVC folders:
1.App_Data Folder
2.Content Folder
3.Controllers Folder
4.Models Folder
5.Scripts Folder
6.Views Folder
7.Shared Folder
8.Bin Folder
App_Data Folder:
The App_Data folder is for storing application data.
Content Folder:
The Content folder is used for static files like style sheets (css files), icons and images.
Visual Web Developer automatically adds a themes folder to the Content folder. The
themes folder is filled with jQuery styles and pictures. In this project you can delete the
themes folder.
Controllers Folder:
The Controllers folder contains the controller classes responsible for handling user
input and responses.
MVC requires the name of all controller files to end with "Controller".
Visual Web Developer has created a Home controller (for the Home and the About
page) and an Account controller (for Login pages)
Models Folder:
The Models folder contains the classes that represent the application models. Models
hold and manipulate application data.


View Folder:
The Views folder stores the HTML files related to the display of the application (the
user interfaces).
The Views folder contains one folder for each controller.
Visual Web Developer has created an Account folder, a Home folder, and a Shared
folder (inside the Views folder).
The Account folder contains pages for registering and logging in to user accounts.
The Home folder is used for storing application pages like the home page and the
about page.
The Shared folder is used to store views shared between controllers (master pages
and layout pages).
Shared Folder:
It is a subfolder of the Views folder. It used for multiple views. It holds global Master
Pages, Error Pages and User Controls used by multiple controllers. This folder is not
associated with any particular Controller.
Bin Folder:
Bin: It holds the compiled .NET assembly for our MVC web application and any other
assemblies it references. IIS expects to determine the DLLs in it. During compilation
VS copies any referenced DLLs (except those from the system-wide global assembly
cache) to it. IIS won't serve its content to the public.

You might also like