On JavaScript

Last Thursday we were lucky to have my former student, Tom Aratyn, come and give a talk on JavaScript.  It was neat having Tom come to speak to this year's crop of Seneca-Mozilla hackers, since he was literally the first student I had working on anything related to Mozilla.  Tom proved to me that students, and undergraduate students at that, could play at this level, and it's been full steam ahead ever since.

I asked Tom to come and speak about extensions, since that's what we're studying right now.  Tom works fulltime as the lead developer at Security Compass, building security tools as Firefox Extensions.  He agreed to come, but told me he wasn't going to talk about extensions, but about JavaScript instead.

I thought it was a fantastic idea.  By the time I get the students in their third or fourth year, they have taken at least 3 courses on C/C++, a few on Java and .NET, many web and scripting courses, etc.  In total the students have probaly learned and developed in no fewer than six programming languages.  "When I started working in JavaScript fulltime, I came to a point where I had to start over, and go read the ECMA spec.  Reading that, along with some papers about closures, I had an 'aha!' moment: JavaScript isn't like anything else I'd learned before,"  Tom told me.

It really isn't.  One of the language's strengths is that it looks like something you've seen before, and becuase of that you are tempted to bring what you know about all those other curly-bracket languages.  JavaScript is plyable enough to let you do things you knew how to do before, inheritance for example.  It happily lets you do what you want, but leaves subtle hints that you might want to do something else, that you might need to think differently.

Steve Yegge wrote an interesting post recently about his work to write a JS interpreter in emacs, and one quote toward the end really resonated with me:

...JavaScript is a language that smart people like. It's weird, but I keep meeting really really smart people, folks who (unlike me) are actually intelligent, and they like JavaScript. They're always a little defensive about it, and almost a little embarrassed to admit it. But they think of it as an elegant, powerful, slightly flawed but quite enjoyable little language.  I tell ya: if you're a programming language, it's a very good thing to have smart people liking you.
I've had this exact same feeling for a long time, not coincidently the same period I've been working closely with people at Mozilla.  This is a somewhat long way to get to my original intent in writing this, which was to share a link to a great post by Mozilla's Jason Orendorff, who works on SpiderMonkey (Mozilla's JavaScript engine).  Jason does a great job describing from the bottom-up what Tom was talking about from the top-down, specifically looking at how the scope chain works.

Tom's talk got me reflecting on the fact that we really need a proper course on JavaScript, one that teaches the language as it really is.  We already have two full courses that teach these students to hack on Mozilla, Firefox, Thunderbird, etc.  Why not take it to the next step?  I think a final year option course on JS and the Open Web is something that needs serious thought, and I'm already thinking...

Show Comments