ASP.NET MVC

mvc-2ASP.NET MVC is part of the ASP.NET framework. ASP.NET MVC helps Web developers build compelling standards-based Web sites that are easy to maintain. These standard-based web sites decrease the dependency among application layers by using the Model-View-Controller (MVC) pattern. ASP.NET MVC  application is an alternative to developing ASP.NET Web Forms pages but you should note that it does not replace the Web Forms model.

The Model-View-Controller (MVC) pattern is an architectural design principle that separates the components of a Web application into three main components: Model, View, and Controller. MVC provides complete control over the page markup. MVC improves testability by inherently supporting Test Driven Development (TDD). This inherent separation provides more control over the individual components of the application, allowing easier development, modification, and testings.

Web sites created using ASP.NET MVC have a modular architecture. This modular architecture allows developers working together to work independently on the various modules of the application and then be used to improve collaboration.

For example:

  • Developers can work on the Model and Controller layers (data and logic), while the designer work on the View (presentation).

ASP.NET MVC framework is a lightweight, highly testable presentation framework that is integrated with existing ASP.NET features. Some of these integrated features are master pages and membership-based authentication. The MVC framework is defined in the System.Web.Mvc assembly.

Test-Driven Development Support

ASP.NET MVC framework pattern makes it easier to test applications than it is to test a Web Forms-based ASP.NET Web application.

For example:

  • A single class is used both to display output and to respond to user input in Web Forms-based ASP.NET Web application.

Writing automated tests for Web Forms-based ASP.NET applications can be complex, as you must instantiate the page class, all its child controls, and additional dependent classes in the application to test an individual page.

As many classes are instantiated to run the page, it is hard to write tests that focus on individual components of the application. Tests for Web Forms-based ASP.NET applications is therefore more difficult to implement than in an MVC application.

Web Forms-based ASP.NET application tests also require a Web server. MVC framework decouples the components and makes heavy use of interfaces, thus making it possible to test individual components from the rest of the framework.

 

Related Tutorials:

This entry was posted in ASP.NET 4 Theory and tagged , , , . Bookmark the permalink.