Misdirection and Javascript

When I was twelve, I spent $3.95 on a book that promised to teach me how to do magic tricks that would astound my friends. I didn't make it past the second chapter ("No way---I have to practice!?"), but I still remember the way the word "misdirection" was set in bold face every time it appeared. The key to making a trick work, the book said, was to get the audience to focus their attention on something else. That way, by the time they realized the trick was happening, the hard part would already be over.

A similar effect seems to have played a key role in the success of some of today's biggest software technologies. Unix, DOS, Perl, the web---they all just kind of grew while the grownups were worrying about something else, until one day, everyone turned around and said, "Hey, this is huge!"

So, as a follow-on to last week's post about you and your research, here's another idea that I think has at least a fighting chance of going through that same cycle of stealthy growth followed by overnight success. I think there's at least an even money chance that Perl, Python, and Ruby will all turn out to have been also-rans, and that the dynamic language that eventually succeeds in going mainstream will be (wait for it) Javascript. Here's why:

  1. It has a clean, C-like syntax, and a very conventional imperative programming model, so there are no immediate obstacles to adoption.
  2. It offers everything that have dynamic languages popular, including free typing, first-class everything, garbage collection, and a rich set of built-in tools.
  3. Thanks to IE, Firefox, and Safari, it's available everywhere; thanks to XMLHttpRequest, it can now deliver everything that Java applets were supposed to back in the 1990s. Google Maps is the most famous example of the AJAX (Asynchronous Javascript And XML) architecture that XMLHttpRequest permits, but many others are starting to appear.
  4. Most importantly, anyone who wants to build a professional-looking web site these days has to learn it, which means that hundreds of thousands of programmers are using it every day. (I'm willing to bet that more people are writing Javascript at this instant than are writing Perl, Python, Ruby, and Tcl put together.)

Of course, there's a ton of things missing: I wouldn't use Javascript for command-line data crunching1, for example, since it lacks the thousand and one libraries for LDAP, database connectivity, process control, and what have you that are the real key to those other languages' power. It also lacks IDE support (although projects like jseditor are already addressing this.) Set those against its ubiquity, though, and they seem like small change.

Javascript has one other thing going for it, at least in my eyes: it may be the first widely-used language to include direct syntactic support for XML, via E4X. Whether you like XML or not, it's as much a part of the modern web as HTTP. Ubergeeks might scoff and say, "You can do all that with libraries," but my guess is that any language that treats XML as a first-class native data type is going to look awfully attractive to the other 95% of programmers.

(For more information about Javascript, see Mozilla's Javascript page, which has links to open source implementations in both Java and C.)

1Shameless plug.

In the wake of posts about Shopify's support for white nationalists and DataCamp's attempts to cover up sexual harassment
I have had to disable comments on this blog. Please email me if you'd like to get in touch.