I am on my way to finishing a first ‘proper’ Asp.Net MVC project (don’t worry, it’s tiny) and I thought I’d philosophize a little bit on what went right and what went wrong.
First, some context. What I wrote is basically a small group management web app – something along the line of Google Groups, except that it’s a bit simpler and uses MVC. I stack was C#, Linq2Sql (don’t ask) and Sql Server 2008 as the back-end.
Syntax
If I had to start it all again, I’d pick the Spark view engine instead of the default WebForms one. There’s something utterly ridiculous in writing SomeLongName sln = (SomeLongName[])ViewState["SomeLongIdentifier"], and Spark is the perfect tool to avoid this. Also, the unnecessary proliferation of <%= if (Some.Constant) { %> ... <% } %> clauses is downright annoying, and affects readability of code. True, Spark doesn’t ‘do away’ with such closes (I mean the curly braces and the # prefix), but at least it makes it way more neat.
Linq2Sql
I have no problems with Linq2Sql. At all. For a small site, it’s what the doctor ordered, and given the small load on the web app itself, I’ve never noticed any lag. Well, you have to bear in mind that even high-load sites such as StackOverflow use Linq2Sql, so it’s not the worst tool in the world. Personally, I consider it pretty decent, though I’m using NHibernate on things like DevTalk.
jQuery
I didn’t know any jQuery to start with, but learning it was a breeze, and the fun stuff available as additions (e.g., jQuery UI or the time picker) make it totally awesome to use when you need really good controls, fast.
Styling and Layout
I more or less messed up with respect to layout. I went with using tables instead of divs for the page structure, which made things tricky on a number of levels. I mean, the site works, but it’s not easy to work with its code, because layouting is done by the table, and you have to play by the table’s rules.
Also, I went through two re-styling phases, trying to get the fonts and colours to a state where they could look stylish yet project an aura of seriousness and professionalism.
Content
Made lots of mistakes regarding content. Dead/broken links, links that weren’t clear enough, content that wasn’t placed in the right spot. The only thing I did well is the administration section – but that’s the part that ordinary users do not see, so I was probably the only person to appreciate it.
One real screw-up is that I used <h1> tags for general-purpose content rather than the site name. I can already see that it has affected the site SEO-wise, and that I must revise this policy. Of course, to do this, lots of links need to be changed. I just hope that I can manage it with the ‘Replace In Files’ feature.
Use of AOP
For some reason, instead of using filters I tried using PostSharp for things like authentication. It failed, and failed so miserably that I was forced to wipe out most of my aspects, pick up a book and basically ‘do it right’. Well, that’s another lesson learned.
Error handling
One small success is that I managed to wire up Codeplex.Diagnostics to the database to provide some really good feedback about error conditions. I’ve been very impressed with the framework, and now I use it with other web projects.