The Evolution of Microsoft Web App Development

From Classic ASP and Web Forms to ASP.NET MVC, Silverlight, Web Matrix, and Razor

Jonathan Goodyear

August 20, 2010

4 Min Read
ITPro Today logo in a gray background | ITPro Today

When Microsoft first responded to its Internet wake-up call in the 1990s, it acted quickly because it was behind the competition. It churned out what’s now known as Classic ASP in short order. ASP didn’t allow you to do much, but you could intermix HTML with dynamic content using the familiar <% %> “code nugget” syntax. Classic ASP is an interpreted language, so you had to build and call COM objects to get any type of scalability. It wasn’t a pretty language by any means, but it gained massive popularity because it was an easy on-ramp for developers joining the Internet revolution.

Most Microsoft developers were building 2-tier fat client or 3-tier DNA applications for Windows using C++ or Visual Basic. So when Microsoft built the groundbreaking .NET Framework, it wanted to make web programming easy for these folks. The result was what we now refer to as Web Forms. Web Forms enabled the event-driven development paradigm familiar to Windows developers, making it relatively easy for them to jump on board. Because Web Forms used a system of components and UI controls, there was the same explosion of third-party tools that occurred in the Windows development space. Microsoft never really got its act together concerning the visual designer for Web Forms, but that didn’t deter the enthusiasm that developers showed toward the new platform. Web Forms applications were compiled using the .NET Framework and fully compatible with everything else .NET, plus they were scalable.

As years went by, shortcomings were exposed with Web Forms. It was difficult to get absolute control over the UI, especially when targeting multiple browsers. The results were acceptable for LOB applications, but results were less acceptable with external-facing websites. Plus there was a huge disconnect between designers and developers. Web Forms fell down pretty hard during the early days of the mobile device revolution, despite several attempts to introduce a set of mobile controls. Finally, since event-driven programming wasn’t familiar to developers on other platforms, those developers tended to choose easier (albeit less capable) platforms like PHP. Some beginners chose to stick with Classic ASP.

Last year, Microsoft introduced ASP.NET Model-View-Controller (MVC), which enabled developers to centrally apply data access and business logic, then support a multitude of potential consumers (e.g., PC browsers, phones, tablets) through the old faithful <% %> code nugget syntax. ASP.NET MVC also enabled support for other view syntaxes such as NHaml or Boo. MVC is targeted to the professional developer; it is “pattern-y” with its use of providers, dependency injection, and so forth, in addition to the MVC pattern itself. It’s powerful and extensible but a bit daunting for beginners. Therefore, I welcomed Microsoft’s announcement of Web Matrix, which includes a development environment, a new development web server named IIS Express, a database manager, and a gallery of website templates. What excites me the most, though, is the new Razor view engine. Razor gives you the flexibility to mix code with content like the <% %> code nugget syntax, but with fewer keystrokes, making it much easier to understand.

The Razor view engine can usually determine whether you’re typing code or HTML tags. You don’t need to tell the compiler what you’re doing, and even if you do, the syntax is shorter. For example, code nugget syntax looks like this:

Hello world, the time is <%= DateTime.Now.ToString() %> and I feel great!

You could accomplish the same thing with Razor using the following:

Hello world, the time is @DateTime.Now.ToString() and I feel great!

In a single line of code, you save 4 keystrokes. It gets even better with larger constructs such as if statements and loops because you don’t need to explicitly tell the compiler you’re switching between code and content. For example:

@if(discountCode.IsValid)
\{
    You get a discount
\}

There are lots of things that you can do with Razor; check out some of the resources on the ASP.NET website, http://www.asp.net/webmatrix/tutorials/2-introduction-to-asp-net-web-programming-using-the-razor-syntax. Razor borrowed some concepts from ASP.NET such as HTML helpers that allow you to do things like include a Twitter feed with a single line of code. This is a ripe new market for third-party component vendors. Microsoft wants to attract developers from platforms such as PHP and Ruby. Razor makes this easy, and Web Matrix lets you create PHP projects as a way to help developers make the switch to the Microsoft platform. Developers who prefer event-driven web programming have probably moved to Silverlight, so the decision to create a more “webby” way of building web applications makes sense. Between Web Forms, ASP.NET MVC, Razor, and Silverlight you’re sure to find a web app development method that meets your needs, preferences, and experience level.

Read more about:

Microsoft
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like