Wednesday, February 26, 2014

MVC Tutorial Part 1 : What is MVC?


MVC (Model View Controller) is a software pattern for implementing user interfaces.

It divides a given software application into three interconnected parts, so as to separate internal representations of information from the ways that information is presented to or accepted from the user.

[Software Pattern: Software patterns are well tested and proven development practice or technique which helps in development of a good software product; you can also say it as a template which can be used again and again for all your projects. Some examples of Software patterns are Abstract factory, Factory method, Object pool, Singleton, etc. To learn what is a Software pattern read more on:  [ http://en.wikipedia.org/wiki/Software_design_pattern ]

To understand MVC it’s not necessary to learn or know Web forms. But if you are aware of 3-Tier Architecture which is used in web forms, it will facilitate you in understanding MVC structure better. Web form 3-Tier Architecture consists of Presentation layer or UI layer, Business layer and Data access layer. The Presentation layer is where the UI or front end is developed. The Business layer contains the business logic; by doing so we are hiding data from front end user and keep it isolated from external users and the last layer Data access layer is used for talking to the database. To learn more about 3 Tier Architecture you can refer:[http://www.codeproject.com/Tips/662107/Understand-3-Tier-Architecture-in-Csharp]

What does the 3 component of MVC i.e. Model View Controller defines?

Controller – Controller is the main component of MVC, which means it interacts with both Model and View.

A controller is the one to which user interacts, which further send and receive data from Model and View.  The Controller can send commands to the model to update the model’s state on the other hand it can also send commands to its associated View to change the Views presentation of the model.

Model – Model notifies its associated views and controllers when there has been a change in its state. This notification allows views to update their presentation, and the controllers to change the available set of commands.


View - view is told by the controller all the information it needs for generating an output representation to the user. It can also provide generic mechanisms to inform the controller of user input.

If you want more detailed document and diagram on MVC refer: http://ist.berkeley.edu/as-ag/pub/pdf/mvc-seminar.pdf





Now, let’s discuss benefits of using MVC in short:

  • ·         It gives more control over HTML
  • ·         No Code behind files
  • ·         Separation of Concern [i.e. UI will contain only UI code]
  • ·         Provides ease of testing
  • ·         Easy URL routing
  • ·         No Postback
  • ·         No ViewState

To know more about MVC advantages read through some blogs on: [http://forums.asp.net/t/1459417.aspx]


If it’s still not clear how MVC works, don’t worry you will get more clarity when you move forward with implementation and developing MVC examples practically.



To learn more about MVC follow all parts of this tutorial series.
For detailed documentation and Video notes on MVC visit:


Created by:

Team: Techies@its4u
ITSolution4U – Technology Expert
ITSolution4U Home Page: http://www.itsolution4u.com
Twitter:     https://twitter.com/IT_S4U
LinkedIn:   www.linkedin.com/company/itsolution4u           


No comments:

Post a Comment