james mckay dot net
because there are few things that are less logical than business logic

ASP.NET MVC + jQuery – can things get any better for web developers?

Microsoft’s recent decision to include jQuery in the ASP.NET development stack is pretty exciting news. I’ve been using jQuery for a while now, and all I can say about it is that it makes JavaScript fun. You can use it to add some pretty impressive effects to your web pages with only a couple of lines of code, and you have less to worry about as far as the idiosyncrasies of cross-browser detection are concerned. In the past year or so it’s become pretty popular and even something of a de facto standard in many ways, probably best described as JavaScript’s answer to Linq. If you’re a web developer and you haven’t yet come across it, I really would encourage you to check it out — you’ll love it, even if you hate JavaScript.

Hopefully this will attract some more talent back to the .NET platform. It’s been the case for a while now that the best, most passionate web developers — the ones who come up with the all-singing, all-dancing Ajax-y websites and eye candy — have generally been shunning the Microsoft stack in favour of PHP, Django and Ruby on Rails. You can easily understand why — the web forms postback model may be good for simple, fairly generic things, but if you really want to make your website sing, it has restrictions and leaky abstractions that get in the way a lot, such as the limitation of one server-side form per page, or the convoluted id attributes that it sticks in all over the place making CSS and DOM manipulation a major headache, or the monster that is view state.

However, with the ASP.NET MVC framework on the go, we have finally got back the control over our HTML that we need, and now with jQuery forming an official part of it, ASP.NET is becoming an even more exciting prospect again. It’s especially so since in many ways you can really push the boundaries with .NET a lot further than with most other frameworks. Languages such as PHP or Ruby are good in themselves, but they do have their limitations, and it’s not a good idea to try to use them for image manipulation, or genetic algorithms, or Bayesian spam filtering, for instance — they are just too slow for computationally intensive stuff such as that, and in those cases you would need to drop down to C++. On the other hand, in C#, you can do it all in one integrated end-to-end framework, and with Visual Studio, you have what is probably the best IDE on the market to help you on your way.

I’m looking forward to seeing a lot more all-singing, all-dancing websites written in ASP.NET.


  • # Reply from Richard Marr at 17:31 on 2 Oct 2008

    I agree with you that JQuery is a breath of fresh air, and probably a smart move by the ASP.NET team.

    I’m suspect of your theory that it will attract developers back to ASP.NET though. UI developers want elegant tools, and I think ASP feels too clunky. For example, all of that mucking about trying to figure out DOM IDs for controls. It’s just not a pleasant model to work with, for me anyway. Does the MVC system fix that?

  • # Reply from James at 22:42 on 4 Oct 2008

    Yes it does actually, and that was the point I was making. ASP.NET MVC works in the same way as Ruby on Rails or Django or any of the other MVC frameworks, giving you full control over your HTML. You can use some server controls with it (it’s only postbacks that you lose out on, so you couldn’t use it with controls that need to be rendered in a server-side form such as the GridView or the Calendar) and you can also have some parts of your website in MVC and some in traditional Web Forms if you’re that way inclined (Scott Hanselman has a good post on this.) The upshot of this is that with ASP.NET there’s pretty much an approach to cater for every taste. jQuery is just the icing on that particular cake.

    Incidentally, the key to what I was saying is that I hope it will attract developers back to ASP.NET — unfortunately there are some characters out there who avoid it like the plague for no other reason than that it’s by Microsoft. Personally I think that’s a bit sad, because it really is a very capable framework and you can optimise it to go blazingly fast if you’re so inclined.

  • # Reply from Joel Cochran at 19:12 on 6 Oct 2008

    I’ve been developing web sites for about 10 years: PHP, CGI, JavaScript, etc., and coding C# for the last five. I could never get into ASP.NET. I always found it disappointing that I couldn’t simply use C# when I needed to and regular HTML for everything else: the Postback and Viewstate approach ruined ASP.NET for me. That is, until I found ASP.NET MVC, which I have been using since Preview 2. During Preview 3 I found jQuery, and between the two I am actually having fun developing web sites again.

    While I’m not sure if it will actively draw more developers in, I will say that it certainly makes the idea more palatable for traditional “hands on” web developers like myself. As you mentioned, and Scott Hanselman demonstrated, now there is room in ASP.NET land for virtually everyone.

    Kudos to Microsoft for giving first class support to such an outstanding open source project as jQuery, I hope it is a sign of more to come.

Comments are closed.