Monday, December 12, 2011

A little about ASP.NET MVC 3 (MVC Overview)

These days, MVC is more popular in enterprise web application environment, since it is easy to develop, flexible to manage and able to control over the rendered HTML for Rich Internet Application (RIA). So, we have to know much about MVC for our career as professional. If you are going to abroad like Singapore to find a job as .net programmer, you need to know MVC at all and it is 7 out of 10 times in interviews. Right now, you see how much it is important in IT industry. Let's start here.

The Model-View-Controller (MVC) pattern is an architectural design principle that separates the components of a Web application. This separation gives you more control over the individual parts of the application, which lets you more easily develop, modify, and test them. ASP.NET MVC is part of the ASP.NET framework. Developing an ASP.NET MVC application is an alternative to developing ASP.NET Web Forms pages; it does not replace the Web Forms model.
The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller.
The MVC framework is defined in the System.Web.Mvc namespace and is a fundamental, supported part of the System.Web namespace.

The MVC framework includes the following components:

Models
. Model objects are the parts of the application that implement the logic for the application s data domain. Often, model objects retrieve and store model state in a database. For example, a Product object might retrieve information from a database, operate on it, and then write updated information back to a Products table in SQL Server.

Views. Views are the components that display the application s user interface (UI). Typically, this UI is created from the model data. An example would be an edit view of a Products table that displays text boxes, drop-down lists, and check boxes based on the current state of a Products object.

Controllers. Controllers are the components that handle user interaction, work with the model, and ultimately select a view to render that displays UI. In an MVC application, the view only displays information; the controller handles and responds to user input and interaction. For example, the controller handles query-string values, and passes these values to the model, which in turn queries the database by using the values.

The MVC pattern helps you create applications that separate the different aspects of the application (input logic, business logic, and UI logic) with a loose coupling between these elements. The pattern specifies where each kind of logic should be located in the application. The UI logic belongs in the view. Input logic belongs in the controller. Business logic belongs in the model. This separation helps you manage complexity when you build an application, because it enables you to focus on one aspect of the implementation at a time. For example, you can focus on the view without depending on the business logic. For example, one developer can work on the view, a second developer can work on the controller logic, and a third developer can focus on the business logic in the model.


Advantages of MVC Model

  • Easier to manage complexity by dividing an application into the models.
  • Enable full control over the rendered HTML.
  • Enable Test Driven Development(TDD).
  • SEO and REST friendly URL (Search Engine Friendly).
  • No ViewState and PostBack events.
  • Follows the stateless nature of web.
  • More easy client-side integration (Javascript/Ajax/Jquery).
  • Extensible and WEB 2.0 Enabled 
The following are the helpful resource.
http://www.asp.net/mvc/mvc3

http://msdn.microsoft.com/en-us/library/gg416514%28v=VS.98%29.aspx

http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-1

Fly on the net with MVC. :P

No comments:

Post a Comment