JavaScript Therapy
March 23rd, 2008Our relationship with JavaScript has been turbulent these past 10 years. In the early days there was so much promise as both the Netscape and Internet Explorer teams worked feverishly to add new features to the browsers and coined the term DHTML. It was an exciting time, for a while at least. Then the fact that features did not work reliably or even across the two dominant browsers started to sink in and the polish on this shiny new thing started to wear off. Yet we still persisted in trying to find ways to make it work, only to be slapped in the face over and over again.
One strategy I followed was to focus only on Netscape 4 for certain functionality and I would spend hours trying to nail down my new script, thinking I had the syntax right, alt-tab, F5... and then see inexplicable behavior happen. I naively thought that the Netscape 4 engine for JavaScript was bulletproof and I was wrong. I did not realize until a few years later, after ignoring JavaScript during that period, that the syntax I was using was completely valid. It was just the browser misinterpreting my code.
Starting just a few years back I started to see JavaScript becoming useful again. The combination of Google producing web applications like Google Mail and the Firebug extension for Firefox caused me to reconsider JavaScript one more time. What Google created excited me about what JavaScript could do for my web applications and Firebug offered support for making it happen by exposing what was happening inside the browser.
Gradually as I re-educated myself on JavaScript I picked up techniques to write JavaScript more efficiently and reliably while also making it work across a broader selection of browsers than were available in 1998. And a major push forward was the rising popularity of JavaScript libraries (jQuery, Prototype, YUI and many others has made it nearly trivial to add advanced client-side behavior to web applications that works across all of the major modern browsers. After learning a bit about the available JavaScript libraries I read Pro Javascript Techniques by John Resig which opened my eyes on how much more powerful JavaScript can be. Later I watched a video of a presentation that Resig made for Yahoo! on Advancing JavaScript with Libraries (Part I, Part II). His book is excellent and these videos compliment it very well.
With my efforts to re-educate myself about JavaScript the last few years I feel I have a good relationship with JavaScript. This re-education has been like therapy for this troubled relationship with a once flawed technology. Each time I talk with someone about web development they seem surprised or even shocked that I would be so willing to jump head first into attempting complex functionality with JavaScript. It seems there is a lot more "JavaScript Therapy" that needs to happen. People have not forgotten the bad old days and letting go of that negative experience has been hard for most web developers. I have come to accept the fact that in order to produce rich web applications that I have to leverage JavaScript along with everything I know about HTML and CSS. These three technologies can do amazing things together and as the browser makers compete to produce faster, more stable and more standards compliant browsers these capabilities will only improve.
In the coming weeks I will be writing about what I have learned about modern JavaScript, especially with ASP.NET. In the meantime, if you are interested in JavaScript I strongly suggest reading Resig's book, watching those videos and exploring the tools referenced in Web Development Tools for the Power Developer. Later you can check back here for more on JavaScript techniques.
