Thursday, June 5, 2008

JavaScript is dead, long live JavaScript!

Y'know, a long time ago I decided that I hated JavaScript, then I realized that I didn't hate JavaScript the language, what I hated was the lack of standardization in implementation across all the various browsers.

The more I got into it the more I realized that as a language, JavaScript is really really cool. OK, I admit that the prototype nature of it still confuses me, and its general wackiness takes a lot of getting used to if you are coming from a class-based object-oriented language like Java. But whatever. I welcome the recent renaissance in JavaScript programming thanks to AJAX.

So its funny to me that JavaScript is at once enjoying more success than ever before and at the same time receding into the background. What I think is actually happening is that JavaScript is turning into the bytecode of the new virtual machine. As applications inevitably continue their move to the browser as an execution environment, JavaScript, (and Flash, sure, but it's interesting that ActionScript is derived from JavaScript), is what they are running in simply due to its ubiquity.

That probably sounds like an obvious statement, but consider this, Google was the first to really successfully implement the concept I'm talking about with GWT. The whole notion of writing an application in a Java subset and then compiling it to JavaScript just seemed completely and totally insane when it was released, but it worked really really well.

Since then others have taken up the torch and come along with their own twists on the same concept:
  • The Lively Kernel from Sun borrows heavily from concepts in Smalltalk and Self, and implements an entire graphics system in JavaScript and SVG.
  • I just heard from a someone about this company 280Slides. They are ex-Apple employees that started a Y Combinator company that has created a Keynote clone in the browser. Why is this interesting when there are already a ton of browser-based office apps? You've gotta check out the implementation. It's in Objective J. Yeah, Objective C in JavaScript. Crazy.
I think we're going to see a lot more of this kind of thing. Taking existing languages and creating compilers that translate source code to JavaScript+SVG+Flash+whatever. Sure, the JavaScript libraries will continue to proliferate, but so will this higher-order programming stack. you even see it with things like Rails and RJS, or Wicket, or name-your-other-component-based-web-framework.

Maybe after putting up with so much grief from everyone for not being a "real" programming language JavaScript will have the last laugh. This little language that could will probably be running all our applications someday soon...


rock said...

Yeah, I know I totally glossed over the JavaScript / Flash-Flex war that is emerging and even baited you with that remark about ActionScript. Maybe that deserves its own blog post, but suffice it to say that right now I don't think there is actually a war. The two technologies have the potential to complement each other without it being an all-or-nothing proposition. We'll see...

Howard T. Snidbiscuits said...

Open Laszlo compiles to javascript/html or Flash, it's pretty interesting also.

I don't know about the future of javascript, though - I think it's proving hard to evolve as it will be replaced with a more standard, already existing language.