ASP.NET MVC Framework


The ASP.NET Framework and Web Forms

The ASP.NET method has been a huge leap in the way web applications are developed and deployed. Previously in traditional ASP, code was cluttered and there was no clear and simplified way in which the benefits of object oriented programming could be brought to the web. In addition, there was no clear separation between the presentation layer and business logic, making maintenance of code a big issue.

At the turn of the millennium, Microsoft introduced the .NET framework and extended it to the Internet platform with the introduction of ASP.NET. This new framework allowed the creation of what were called web forms (basically .aspx pages) that allowed the actual code (or the business logic) to be separated from the presentation, allowing each to be modified cleanly. The new .NET framework changed the way web applications were built by introducing the event driven model. This allowed ASP.NET to become a completely object oriented framework.

Properly crafted .NET applications allow for a three tiered approach to web development. The data layer usually mimics the underlying database structure by creating appropriate classes. The business layer manipulate these classes using the exposed interfaces. And the presentation layer merely focuses on what to display. The individual elements of the pages like textboxes and lists derived their values ​​from the business logic.
The ASP.NET MVC Framework

An interesting application design methodology that has been gaining momentum within the .NET community is the ASP.NET MVC framework. Historically, this is nothing new as the MVC model was developed in the 70s. However, with it's formal acceptance into the .NET programming model (and more specifically, into Visual Studio), it is gaining wide acceptance in these circles.

Many programmers felt that the ASP.NET framework tested to imprint a windows style programming onto the web. This went against the way the web basically works. The web is stateless and all ASP.NET webforms tried to bypass this using something called a viewstate that was transferred back and forth between the client and the server.

Using the MVC framework, this has changed into a more flexible and loosely coupled approach. It's a bit difficult to explain the actual methodology used here. However, the basic idea is that each URL corresponds to an action instead of a specific webpage. The controller that is sitting on the server side, responds to each request by breaking down the URL and deciding what to do to which object. For example, to edit the details of an employee, the URL will be … / employee / edit instead of … / employee / edit.aspx . This allows more friendly URL's for readability purposes.

The controller simply looks at the URL and decides to send backa view with takes it's data from the model . Together, these components form a sort of triangle that creates a different way in which applications interact with each other.

The MVC framework can be very confusing for those who are used to the earlier .NET webforms and can not see the need for any change in the way .NET should work. However, for those who are migrating from other programming languages ​​like PHP, the MVC framework should prove easier to understand and learn.


Leave a Reply