few things, and have something that mostly works. Unfortunately, maintaining such
code becomes more and more difficult over time.
With the Ajax revival, developers took a new look at JavaScript. Some of those devel-
opers worked on improving the engines interpreting and running JavaScript code,
leading to substantial speed improvements. Others focused on the language itself, re-
alizing that it had some very nice features and were able to develop best practices like
those outlined in Douglas Crockford's JavaScript: The Good Parts (O'Reilly, 2008).
Beyond the core language, developers built tools that made debugging JavaScript much
easier. Although Venkman, an early debugger had appeared in 1998, the 2006 release
of Firebug became the gold standard of javascript debuggers. It allows the developer
to track Ajax calls, view the state of the DOM and CSS, as well as single stepping code
and much more. Browsers built on WebKit, notably Apple's Safari and Google Chrome,
offer similar functionality built in, and Opera Dragonfly provides support for Opera.
Even developers working in the confined spaces of mobile devices can now get Firebug-
like debugging with weinre, Web Inspector Remote.
The final key component in this massive recent investment in JavaScript was libraries.
Developers still might not understand all the code they were using, but organizing that
code into readily upgradeable and sometimes even interchangeable libraries simplified
code management.
jQuery
If anything can be described as the Gold Standard of JavaScript libraries it would
have to be John Resig's jQuery library which forms a wrapper around the DOM
and other Javascript objects such as the XMLHttpRequest object and makes doing
all sorts of things in JavaScript a lot easier and a lot more fun. In many ways jQuery
is the essential JavaScript library that every JavaScript programmer should know.
To learn jQuery see the jQuery website http://jquery.org, or a number of good
books on the subject such as "Head First jQuery" or the "jQuery Cookbook" both
published by O'Reilly. Many examples in this book are written using jQuery.
ExtJS
Whereas jQuery forms a wrapper around the DOM, ExtJS, from Sencha http://
sencha.com tries to abstract it away as much as possible. ExtJS features a rich
widget set that can live in a web page and provide many of the widgets, such as
trees, grids, forms, buttons and so on that desktop developers are familar with.
The entire system is very well thought out and fits together well and makes devel-
oping many kinds of applications a joy. While ExtJS tends to be heavy in terms of
the size of the library it is a good fit for some kinds of application development.
On nice feature of ExtJS is that many of its objects know how to save their state.
So if a user takes a grid and reorganizes the columns the next time the user views
that grid it is possible to set it up so that this state is saved. How to use the HTML5
localStorage to enhance this will be shown in “Using localStorage in
ExtJS” on page 51.
6 | Chapter 2: The Power of JavaScript