MVC Architecture

Model–view–controller (MVC) is a software architectural design pattern which separates the representation of information from the user's interaction with it. Model, View & Controller are independent class files. The model consists of application data, business rules, logic, and functions. A view can be any output representation of data, such as a chart or a diagram. Multiple views of the same data are possible, such as a bar chart for management and a tabular view for accountants. The controller mediates input, converting it to commands for the model or view. The central ideas behind MVC are code reusability and separation of concerns.

The MVC pattern isn’t new—it dates back to 1978 and the Smalltalk project at Xerox PARC—but it has gained enormous popularity today as an architecture for web applications, for the following reasons:

User interaction with an MVC application follows a natural cycle: the user takes an action, and in response the application changes its data model and delivers an updated view to the user. And then the cycle repeats. This is a very convenient fit for web applications delivered as a series of HTTP requests and responses.

Web applications necessitate combining several technologies (databases, HTML,and executable code, for example), usually split into a set of tiers or layers. The patterns that arise from these combinations map naturally onto the concepts in MVC.

Extensibilty

The MVC Framework is built as a series of independent components—satisfying a .NET interface or built on an abstract base class—so you can easily replace components, such as the routing system, the view engine, the controller factory, and so on, with a different one of your own implementation.

The ASP.NET MVC designers set out to give you three options for each MVC Framework component:

Use the default implementation of the component as it stands (which should be enough for most applications).

Derive a subclass of the default implementation to tweak its behavior.

Replace the component entirely with a new implementation of the interface or abstract base class.

Tight Control over HTML and HTTP

ASP.NET MVC recognizes the importance of producing clean, standards-compliant markup. Its built-in HTML helper methods produce standards-compliant output.

ASP.NET MVC–generated pages don’t contain any View State data, so they can be hundreds of kilobytes smaller than typical pages from ASP.NET Web Forms. Despite today’s fast broadband connections, this economy of bandwidth still gives an enormously improved end-user experience.

ASP.NET MVC works in tune with HTTP. You have total control over the requests passing between the browser and server, so you can fine-tune your user experience as much as you like.

AJAX is made easy, and there aren’t any automatic postbacks to interfere with client-side state. Any developer who primarily focuses on the Web will almost certainly find this to be hugely freeing and the workday more satisfying.

Testability

The MVC architecture gives you a great start in making your application maintainable and testable, because you naturally separate different application concerns into different, independent software pieces. Yet the ASP.NET MVC designers didn’t stop there. To support unit testing, they took the framework’s component-oriented design and made sure that each separate piece is structured to meet the requirements of unit testing and mocking tools.

Testability is not only a matter of unit testing. ASP.NET MVC applications work well with UI automation testing tools, too. You can write test scripts that simulate user interactions without needing to guess which HTML element structures, CSS classes, or IDs the framework will generate, and you don’t have to worry about the structure changing unexpectedly.

Powerful Routing System (System.Web.Routing)

The style of URLs has evolved as web application technology has improved. URLs like this one:

/App_v2/User/Page.aspx?action=show%20prop&prop_id=82742

are increasingly rare, replaced with a simpler, cleaner format such as this:

/to-rent/chicago/2303-silver-street

Good Reasons

search engines give considerable weight to keywords found in a URL.

many web users are now savvy enough to understand a URL, and appreciate the option of navigating by typing it into their browser’s address bar. Third, when someone understands the structure of a URL.

when someone understands the structure of a URL, they’re more likely to link to it, share it with a friend, or even read it aloud over the phone.

it doesn’t expose the technical details, folder, and file name structure of your application to the whole public Internet, so you’re free to change the underlying implementation without breaking all your incoming links.

Post your Suggetion or Comment
Name :
Email Address :
Comment :