?

Log in

No account? Create an account
Neil de Carteret
It's not his fault - we made him that way.
n3dst4
n3dst4
A round-up of JavaScript development tools
Not so very long ago, client-side web programming in JavaScript was painful. There were no debuggers, no way to add instrumentation other than alert("Bing bong!"), no frameworks, and no tool-chain except your favourite text editor and a browser.

But now we have JavaScript consoles in Opera and FireFox, plus Firebug Lite for everything else. Then there's full-fat Firebug for DOM wrangling, XHR inspection, profiling and debugging, and the Web Developer Toolbar for tweaking, poking and prodding.  Even MS are on the case with the IE Developer Toolbar (which is a bit like the FireFox WDT plus a DOM inspector), and the MS Script Editor (which is part of Office, for some unknown MS reason).

Also, today I found JSLint. It's hardly new, but somehow it had never reached my radar before. If you've use lint, the C code nanny, you'll know what to expect: it pulls a fine-toothed comb through your code and picks out all those things which might not actually stop your code from running, but which are Bad anyway, like undeclared variables, missing semicolons etc.

I think the crassly-named Web 2.0 movement is having some great effects here - people are waking up to the fact that JS is actually a really nice, powerful, dynamic language, not just a toy syntax for DOM fiddling. Having functions as first-class objects really shows that the designers were thinking about expressiveness when they wrote it. Of course, it took some time for the libraries to catch up, but now we have a plethora of fantastic and mostly open source frameworks.  Shining brightest among them at the moment is JQuery, which takes the concept of anonymous delegation with JS functions and turns it into your main paradigm.

The JQuery-based JS code I've just written is about 150 lines, across 6 functions. Would you care to guess how many local variables there are in that lot? The answer is three. That may not be a very useful metric on its own, but it's deeply indicative of how much JQuery lets you write code in the order you need it, so you don't have to keep swathes of local variables hanging around for later use.

I'm going to round this off by offering some big love to Apple's Safari for Windows beta. Safari looks gorgeous, even in Windows, and yet it has the snappiest rendering engine and JS interpreter in existence. Seriously. I'm running FireFox 2.0, IE6, IE7, Opera, and Safari side-by-side on the same Windows XP machine for compatibility testing, and Safari is just spanking the opposition for performance. It also hasn't put a foot wrong with rendering yet. Best of all, WebCore and JavaScriptCore (the bits of Safari which are so fast) are open source. If they release a Linux build, I'll switch to Safari as my day-to-day browser in a heartbeat.