Invaluable JavaScript Tools

If you write a lot of JavaScript, then you’ll find Matthias Miller’s website
chockfull of useful information. And even better, he’s put together two great
tools.

The first is JavaScript
Lint
, a tool that analyzes JavaScript code and reports potential
errors. Mozilla’s SpiderMonkey JavaScript
engine has similar functionality, which you can turn on by typing about:config
as the URL and then searching for javascript.options.strict. However, JavaScript
Lint detects more types of errors and is configurable. To give it a try,
I ran it over the MapBuzz code base and was very impressed by the errors it revealed.
I immediately added it to our automated testing processes (i.e., its spawned
by a rake task
now) and have come to depend on it.

And if that wasn’t enough, Matthias has adopted a second tool, called Drip,
that detects memory leaks in Internet Explorer’s JavaScript engine. Memory
leaks occur in IE because it uses COM based
reference counting to delete objects. Reference counting is
fast, and easy to understand, but does not handle
circular object
references. As you use your website in IE, Drip keeps track of these circular
references. Once you’re done, it prints out a report showing you where the
memory leaks occurred.

Thanks for the great tools Matthias.

Update1 – A few people have pointed out some negative articles aboout JSLint. I’ve never used JSLint so I don’t have any opinions about it. What I’m talking about above is a totally separate project called JavaScript Lint (confusing, isn’t it?). I highly recommend JavaScript Lint, it turned up a number of bugs that I hadn’t caught previously. In addition, it is highly configurable so it’s easy to turn off certains classes of errors. And for the utmost in flexibility, you can annote your code to tell JavaScript Lint to skip certain sections of it.

Update 2 – A couple of people mentioned FireBug and Venkman as invaluable tools. I couldn’t agree more – I posted about Firebug a while back when I first started using it. And Venkman has been an old favorite for years – it was great to see it finally updated to workin Firefox 1.5. Hopefully it will also be quickly updated to work with Firefox 2.0. And if you’re debugging Internet Explorer, Visual Studio provides a good JavaScript debugger as does Microsoft’s free script debugger package.

  1. James
    August 20, 2006

    Do you have a link for Matthias Miller’s website?

    Reply
  2. Charlie Savage –
    August 21, 2006

    Hi Ben – great points and I totally agree.

    I [posted](http://cfis.savagexi.com/articles/2006/03/31/firebug) about Firebug a while back, but should have mentioned it again.

    And Venkman is invaluable when you really need to see what is going on – I particularly like its ability to stop on errors and exceptions. That makes it a lot easier to figure out certain classes of bugs (for example, errors that occur when a XmlHttpRequest request returns).

    Reply
  3. August 21, 2006

    is there a way how to print or save a immage out of java generated graphics? i had some server generated java unable to save it anyway (or extension for firefox).
    thanks

    Reply
  4. August 22, 2006

    Thanks for the kind words, Charlie. I’m glad to hear these tools help you out!

    Reply

Leave a Reply

Your email address will not be published.

Top