Why not Classic (Legacy) ASP?
Date Published: 07 October 2009
Yesterday I got the following email, which I thought raised some good points that I thought were worth addressing here in my blog in addition to the reply I sent directly.
I’ve been following your blog (as well as Rob C. and Scott H.) as I look into dipping my toes into MVC. I just read you "How I Got Started in Software Development" and your description of the joys of lightweight ASP development really hit home. So I have a perfect question for you.
I’ve been in the MIS/IS/IT/ICT field for, well, as long as it’s taken me to collect all those acronyms. I’ve been doing lightweight webapp development since the late 90s, starting first in CDML, then ColdFusion, then classic ASP.
For the past few years, I’ve been developing some first-rate classic ASP webapps using a heavy does of AJAX (jQuery) for the UI interactivity. The problem is, nobody takes these webapps seriously, and I’m constantly taking flack for not moving to a "real" framework. And yet as I look at many of these frameworks, they seem like overkill in all the wrong ways. ASP.NET WebForms, in particular, makes me want to run out of the building screaming.
And yet, many clearly smart and experienced people like yourself are rallying behind these frameworks. What’s up? What am I missing? What’s the draw? And please don’t spin that old "spaghetti code" yarn; as Rob writes, "Spaghetti is as spaghetti does".
Thanks for taking the time to read this, and hopefully even to answer.
another confused old-school ASP guy,
Here’s my emailed response:
Read these three books when you get a chance:
- Working Effectively with Legacy Code by Michael Feathers
- Agile Principles, Patterns, and Practices of Software Development in C# by Robert Martin and Micah Martin
- Clean Code by Robert Martin
Now, to properly answer your question. The big reason why I won’t wish to return to ASP is the lack of ability to reuse and properly test code. As applications grow in size and complexity these two things are critical to retaining the ability to make major changes to the site’s design. Include files are a poor substitute for OO patterns of reuse. Also ASP uses COM which is a PITA in its own right, lacking xcopy deployment and forcing you into DLL hell that I don’t wish to return to (for instance, you can’t have two versions of a given component on the same machine, requiring separate instances of the OS just to run side-by-side versions of an app). Plus, talking to databases is something that should be done via an ORM tool if at all possible, and certainly not with lots of hand-written ADO plumbing code. Perhaps the ORM landscape has changed since I last did ASP 9 years ago but and there are numerous effective options, but if not, that alone will ham-string your productivity.
If you liked the clean separation that ASP afforded, you should like MVC views which will let you do your jQuery + Services approach easily but will also let your services run in .NET where they can take advantage of ORM tools, better performance, unit testing, and inheritance/polymorphism as well as new language features like LINQ and built-in platform features like caching that ASP lacked. Give it 3 months’ time on a real project and email me back and let me know what you think.
I’d also recommend some of the other books listed on my Favorite Developer Books post, which I’ll need to update soon to include the two Martin books I referenced in my response. Yes, you can write well-structured web applications in ASP. Yes, writing them with jQuery and a clean separation between UI and data and business logic is a good way to avoid spaghetti code. However, as the reader has found, support for this technology stack is all but gone, and there are many benefits to be had from moving to a modern stack like .NET (which itself is getting somewhat long in tooth, nearing 10 years of age). If he’s very enamored with the dynamic nature of ASP, Ruby is likely a good choice for him to check out as an alternative. But if he likes the Microsoft toolset and stack, then I’ll stick with my recommendation that he go to ASP.NET MVC, and avoid the VB6-like ASP.NET Web Forms model.
Another benefit I neglected to mention in using .NET over ASP is the ability to debug the code. Honestly I don’t use the debugger that often (tests > debugger usually) but when I do need it it’s extremely valuable. And I can say that on the rare occasions when I’ve had to work with ASP code in the last 9 years or so, both my own and clients, it’s been universally unpleasant compared to ASP.NET MVC, which has been a joy across the board. However, I wouldn’t say that any of the ASP apps were written as well as the author of the email writes his.
How many other readers are still using ASP for new applications today? Are you trying to incorporate modern advances like ORM tools, jQuery, web services, etc. or do you build them the same way people built them 10 years ago? What are the biggest pain points you face?
Steve is an experienced software architect and trainer, focusing on code quality and Domain-Driven Design with .NET.