Friday, April 17, 2009

The sorry tale of the Visual Studio Web Site


The first 1.0 release of ASP.NET introduced a way of building web sites that was very different from classic ASP. Developers that had grown up with script embedded in HTML that executed on demand were suddenly faced with a full blown object oriented web framework. For enterprise developers like me who had been chaffing at the awfulness of VB script, it was a revelation. But for many casual web designers working on simple sites, the new complexity was overwhelming.

Take my friend Roy for example. He’s a successful freelance web designer/developer. Typically he takes requirements from small businesses and knocks out small sites usually with a simple backend database. His programming chops are limited to simple control structures; “what more do you need than an ‘if’ statement?” He has no interest in learning object oriented programming. He sees it as academic and over complex. I have no doubt that Roy would epically fail if he was tasked with building the kind of large scale enterprise applications that I work on. But he doesn’t do that; instead he has many satisfied small business customers that really like his quick, pragmatic and cost-effective approach.

Soon after ASP.NET was released he used it to build a web site for a business idea he had. Rather than his usual ‘few days’ turnaround, he spent weeks trying to get a handle on the new model. He just about managed to make it work, but he was enormously frustrated. He never touched ASP.NET again. To this day he codes his sites using classic ASP. He’s mostly abandoned Visual Studio and instead works with Dreamweaver. As far as he is concerned Microsoft lost their way with ASP.NET.

Many small web design shops felt the same way. At around the same time the LAMP stack was really taking off. PHP was just like classic ASP, but better. If used with a tool like Dreamweaver, the web design experience was excellent. For an ‘if statement’ man like Roy it offers a far more compelling alternative than complex object oriented world of ASP.NET. The word on the street was that PHP rocked and ASP.NET sucked.

Microsoft was listening, and they panicked. With the release of Visual Studio 2005, in a desperate attempt to keep the scriptable template market, they removed the classic ASP.NET web project and replaced it with the abomination known as the ‘web site’. Rather than give the Roys what they really wanted: a better classic ASP; they created a monster.

The ‘web site’ project type tries to pretend that .NET is a scripting environment by implementing on-the-fly page-by-page compilation and removing namespace conventions. It tries to pretend that a site is just a bunch of files by removing the MSBuild project file and doing strange things with the solution file. If you mistakenly chose to use the web site project type for enterprise application development (and you had no choice for a while) you soon found yourself in a world of pain. Just try having a separate unit testing project, or doing CI.

The loud and clear WTFs coming from the enterprise developer community meant that Microsoft quickly resurrected the original Web Application project type, first as a patch and then as part of SP1. But they couldn’t quite bring themselves to admit what a huge mistake web-site was, so there it sits, waiting to snare the na├»ve developer. Don’t be fooled, if you are building serious web applications use Web Application. If you want scripted templates, use PHP.


Neil Mosafi said...

Agree with you on all points, though I think SharePoint had a major influence here, which still uses web sites and not web projects. This is so you can create new sites and upload new files using the web interface or SharePoint Designer without having to upload any dlls

Richard OD said...

Whilst I agree that Web App project is better than the WebSite option, I recently inherited a Website project from a coworker that had left and had no issues setting it up to work with CruiseControl.

There was no need to upgrade it to a Web App project, so I left it as is.

Interestingly the open source stack of choice now seems to be XAMPP- at least that's what I hear from people that I know doing that sort of thing.

gunteman said...

I agree. The "Web Site" model was just a panic response, and it just wasn't very well tested. Sure, it works, but it's just not very good. However, ASP.NET has quite a few other design flaws which puts PHP, Python and RoR in the forefront. The "enterprise suitability" argument doesn't quite cut it, but it could have if Microsoft had focused in this area, instead of trying to make ASP.NET into a beginners tool. Not only the "web site" model is an example of this, but also the DataSource controls et. al.

XAMPP and LAMP has been the number one choice for ages, but I think the popularity of XAMPP comes more from the X than from the extra P (Perl).

Bertrand Le Roy said...

Actually the compilation model that web sites use dates back from ASP.NET 1.0.

Ian Nelson said...

Cool, another in Mike's handy cut-out-and-keep set of URLs to forward to clients when they ask "Why?". Thanks!
Soon I'll be able to forget all this stuff forever.