Friday, April 8, 2011

Javascript is here, its jQueer, get used to it

I’m way late to the javascript bandwagon.  I’ve long held the opinion that heavy use of client-side javascript in web applications made them messy.  No compiler checking, no type safety, excessively verbose DOM manipulation syntax, fragile browser specific nuances, duplication of logic already written on the server, and so on.  I, for one, always appreciated that ASP.NET server-controls and later ASP.NET Ajax largely hid that from me.  The framework would generate and inject the messy javascript required to make things work.  But the days of the framework being able to do this in a way that supports the rich interactivity that web application development requires, have long since been over. 

It’s increasingly apparent to me (maybe I’m the last person to realize this) that getting by with only a sprinkle of javascript, and cursory knowledge of the language and its libraries, is like burying my head in the sand.  Libraries like jQuery have largely solved the DOM manipulation, messiness, and browser specific problems. Additional jQuery plugins as well as libraries like Knockout also aim to further solve some of these shortcomings.  And while type safety and compilation may have felt like deficiencies in the past, the popularity of dynamic languages like Ruby and Python have legitimized that same power in javascript. 

Recent podcasts have further opened my eyes to the power and ubiquitousness of javascript.  It’s clearly not the toy language I had always felt it to be. 

I’m currently reading JavaScript: The Good Parts, as my first act of contrition to the javascript gods.


  1. Javascript is like a drug. Properly prescribed and used, it can be useful. But it's the abuse that's dangerous. My guess is that you probably avoided it b/c the javascript that's rendered by server controls and the MSFT AJAX library (except for the latest version) is convoluted and highly "obtrusive". It also didn't help that before ASP.NET 4 the control names when rendered were ridiculous, and one could never fully trust what an element was going to be called. Embedding a bunch of <%= Control.ClientID %> always made me uncomfortable. For me, it was the webforms model that precluded my experimentation with the drug.

  2. I wish I could say that. But my aversion goes back to the classic ASP days. I just always found javascript to be messy, maybe I secretly wish VBScript had won.

  3. Ah, got it. Didn't think of that angle, but makes perfect sense. Let us know how that book changes things (if it does).

  4. You should share that book with your co-workers. Oddly enough a js error initially prevented me from commenting

  5. jQueer doesn't solve anything. It only aggravates the ocean of bad code around the 'net. Stay away from it if you really want to contribute something good.