From ASP.Net to MVC.Net

Halfway the nineties the internet became available for the public. I created my first html-page, later on I realized some things should be automated and I managed to find a job in -what I call- the automation of web-sites (“oh, you work with the internet, then you can help me with my email…”). Then it started from what we now call ASP-Classic to ASP.Net and MVC.Net. Some thoughts about it.

First there is HTML, text with additional tags to markup the information and structure. A browser recognizes the tags and can show the markuped text by using bigger fonts for headings or other transformations. Static html pages were not suitable when you wanted to update a site often. Because html is a text file, it was possible to generate this text and html programmatically and create dynamic webpages. Next to the html-tags, also scripts with some logic could be added to the html-page. When this page was requested, the script was processed on the server, so content and html could be added or omitted, and the result was send to the website visitor.

Active Server Pages was the solution created by Microsoft. ASP consists of 2 parts: the VB-script for the logic and flow, and there was the part that enabled to handle requests and responses to or tho the world outside the page, like a database or the web-server.

Microsoft also had Visual Basic to create windows-applications. In an attempt to bring Windows and internet-development together, Microsoft created .Net-Framework and provided new versions of Visual Studio as a powerful tool to work on both project-types.

It brought a new way of web-developing: the ASP page was replaced by an ASPX-page. This file contained the html, while the logic moved to a “code behind”-file to support the separation of presentation and logic. To see it working a project must be build: code is now compiled to a .Net-assembly in stead of interpreted. Microsoft tried to merge the structure of a Windows application into the web development by supplying ASP.Net controls that could render html. You could add these to your ASP.Net page and set some properties to change behavior or presentation. And you could create your own controls by combining some .Net controls and logic in a custom usercontrol.

In the meantime, next to Visual Basic (VB.Net) C# became more popular, and there was more emphasis on software architecture. Object Orient Development enabled separation of concerns, layers and tiers. On the other hand, the way controls can be used in a windows-application differs from a web-project. A windows application has one life: you start the program, and your data is available until you stop the program. A webpage has a short lifetime, after it is send to your browser it does not exist anymore on the server. So the ASP.Net solution provided page life-cycle-stages as page-events as a complex way to keep the viewstate to rebuild the page as-it-was, before processing the real request. Also web technology evolved: css and javascript became mature and supporting frameworks could enrich a webpage.

So the concept of development for windows did not flawless integrate into ASP.Net. However, with the support of Object Orient Development in dotNet it provided a new way of web development.

Microsoft embraced the Model View Controller and incorporated it in dotNet as MVC.Net. With the old ASP.Net the visitor of the website requests a URI that maps to a physical ASPX-file. On the server-side this file will dynamically collect data and parse it into the page, and send the response to the visitor. With MVC.Net a visitor will not have a different experience. But the request is in fact interpreted as a command for the server, like “show me your start page”, “give me the details of product X” or “put this product in my shopping cart and show what I collected”. On the server-side the request does not map to a file but it is routed to a method in a “Controller”. This method processes the request and put the result in a “model”. This is an object containing the data for the response to the visitor, and it will be rendered in a “View” that contains the HTML suited to present the information in the model. This is MVC in a nutshell, and the concept of MVC provides a far better way to build web-applications.

Web-developing is not the same as Windows developing AND that’s why ASP.Net becomes legacy, like ASP-Classic.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s