Before working with MVC, I would claim to be somewhat intimidated by JavaScript development. Not that I did not know how to use it, however I found that is was much more bug prone and harder to develop against. Having the .Net compiler was a nice safety net-I did not have to worry about variable name mismatch, typos, not to mention the .Net framework itself. In a recent ASP.Net project we used the MS AJAX update panel to implement interface changes that could easily be implemented via client side JavaScript. For example a ‘select all’ link to select multiple checkboxes was implemented as a button click event in the code behind with an update panel. Certainly not the best way to do this, but the thought was to let the Code-behind do the heavy lifting.
With the advent of AJAX(Web 2.0), MVC, and JQuery, it is no longer a viable option to attempt implement all interface functionality on the server. I believe the expectation of users has changed with relation to page life-cycle and page post backs. Consider Facebook, Google or most of the prominent websites.
Fortunately in MVC and other prevalent technologies, I no longer fear JavaScript as much as I used to. Certain changes make JavaScript development much more of a pleasant experience:
- JQuery just makes JavaScript development x10. For example with JQuery you can do many thing in one line of code: display a dialog, replace the contents of a div tag from a server side method
- JQuery greatly simplifies JavaScript in several ways, including cross browser compatibility. There is no longer any need to write customizations for different browsers.
- Better debugging support in browsers including IE7+, as well as Visual Studio. (I usually use IE’s debugging, it is easier to use.
- Utilizing MVC allows easier querying of DOM elements. Ids like ‘ctl00_pagebody_ucLocalDashboard_tcTabby_tpSetups_ddlPageSize’ are no longer used.