Sunday, July 10, 2005

Making Javascript Bearable with JSAN

So with all the activity around doing interesting things with Javascript and DHTML lately, it seems like an awful lot of hackers who haven't really spent all that much time playing with Javascript in the past are starting to look at it more seriously now.

Personally, the thing that bugs me most about Javascript has always been that the standard way of sharing code has basically been cut and paste off of other web pages. There's no built in module system, so you're basically just #including swaths of code, and there are few good resources for finding decent code.

Fortunately, this is all starting to change. There are some great open source Javascript libraries out there (Prototype, Scriptaculous, and more) that can serve as both fantastic examples and good ways to avoid reinventing the wheel, and people are starting to build tools that work around the lack of a built in module system.

This weekend, I spent some time playing with JSAN, an attempt by some members of the Perl community to bring some of the better parts of the Perl world (namely the module system, test libraries, and CPAN) to Javascript land.

So far, I'm impressed. The test libraries and module system are quite slick, and the infrastructure for uploading new modules is starting to fall into place. Work remains to be done, but it's clear that progress has been made and they're on the right track.

After playing around with this stuff for a day or so I'd say there are a few places that still need some work.

First, there's no tool for automatically installing the packages, so you are basically stuck just downloading the tarball and copying the .js files into place manually. This isn't a huge problem, but it means that dependencies are kind of a pain in the ass.

The dependency problem rears its ugly head most noticably in the testing world. If I want to use the test libraries I basically need to bundle them with my module, and for the life of me I can't figure out how to make use of them via manual inclusion of the .js files, so that means I'm also stuck bundling a version of JSAN.js.

Finally, and this is only going to affect people who are actually writing and releasing modules on JSAN, the upload server (JAUSE) doesn't give you much visibility into what's going on. I uploaded my first module last night (well, really early this morning technically), and it hasn't shown up yet, and I have no way to tell if everything worked or not. In CPAN land the upload server seems to give more feedback to the user, via email and the ability to look at log files for the PAUSE daemon.

In any event, despite any current problems JSAN appears to be a big improvement over the existing Javascript world, and I'm sure the current problems will be worked out in the near future.

1 comment:

  1. You can put the Test.Simple modules into the tests directory and load them in simple script tags: First Test.Builder, then Test.Simple or Test.More. You can also add an index.html file that loads Test.Harness.Browser and runs all of your test files.
    HTH,
    Theory

    ReplyDelete