So the past few weeks I’ve been re-writing my website. Previously it was written in Classic ASP (yes, you read that right) and it was running off a Microsoft Access database. Yes, you read that right too.
The code has served me well since I launched in 2006, and can I point out, that was NINE years ago. I have to salute classic ASP for doing a pretty bang up job. The site rarely went down, it was never hacked (apart from a mountain of comment spam) and it was all-in-all, pretty good fun.
But the past couple of years has seen a huge improvement in website coding. It’s all so much easier and more fun now, so I figured I might as well rewrite it in ASP.NET and move it to MVC. So here’s the full stack of technologies:
<ul><li>Bootstrap for the front end - fantastic library once you get your head around it</li>
<li>JQuery for the little ajaxed archive box over to the right</li>
<li>ASP.NET MVC4 for the back end</li>
<li>Entity framework for talking to the DB</li>
<li>SQL Server for the DB</li></ul>
The whole thing was coded using Visual Studio community edition and SQL Server express. Half was written on my desktop, and the other half was written on my MacBook air running a windows 7 VM using Parallels - a process that ran surprisingly well. I synced the code between the two machines using Git Gui, another process that ran surprisingly well.
So what’s great about the new technology stack and what’s not so great?
<h3>Friendly URLs - Good</h3>
Nice URLs in classic ASP weren’t impossible, but they weren’t exactly easy. Nice URLs in Webforms was possibly even harder! But in MVC… URLs can be super, super friendly. The routing options are many and super variable, and it’s all pretty cool. It’s quite fiddly to setup, but it’s pretty powerful and very nice. You’ll see that each blog entry URL on this site has the format /year/month/title. Easy to setup and makes a lot of sense.
<h3>Entity Framework Good</h3>
I love the entity framework. For basic CRUD operations it’s a life saver. Super easy to setup and use, it’s amazing. If you’ve never had to go down the whole “1 stored proc for each database query” you have no idea just how much time you’re saving. For anything more complicated than simple queries I’ll be using stored procs (stored procs are ace) but for the basics, Entity Framework is awesome.
<h3>Javascript + CSS bundling and minification Good</h3>
I love bundling and minifying my javascript and CSS. Your site loads quicker, it uses less bandwidth, it’s a win-win. The new bundling and minifying libraries are awesome. Easy to setup and use and do the job perfectly. Great job microsoft.
What’s not so great?
<h3>Config Files Bad</h3>
Haven’t we learnt enough from the horror that is Java??? I was super happy to move away from Java 10 years ago. It had become XML configuration file hell. The web.config file is great, but boy can it be over-complicated. On top of that a typical MVC project can have multiple web.config files (mine has 3). As far as I know there’s no nice easy to read reference for the web.config file format, and I’m always discovering more undocumented “features” that need to be set. (minFreeMemoryPercentageToActivateService I’m looking at you). Please, Microsoft, continue simplifying the web.config file, not complicating it.
<h3>Project Layout Bad</h3>
MVC straightjackets you into a particular project layout. You basically have to put your Controllers into /Controllers, your Views into /Views, your javascript into /Scripts, etc etc etc. Now I’m well aware that technically you don’t have to, but if you want NuGet to play properly and if you want Visual Studio to play properly, you’re going to have to meet it halfway. This is not a lot of fun, especially when the standard layout is pretty, erm, weird. Adding areas to your project just makes it more confusing. Not cool.
<h3>NuGet Bad</h3>
Ok I’m going out on a limb here. I’m not crazy about NuGet. It does weird things to your project without telling you what it’s done. Trying to find the “official” or “right” version of a library is difficult. Trying to figure out dependencies (and dependencies of dependencies) is even more difficult.
Ok end of whinge.
Big thanks to the master of security Troy Hunt for his excellent security scanning tool which I’ve run the website through.
Are there any other libraries or tools that I should be considering?