Wednesday, April 01, 2009

The JavaScript Tsunami

If you are currently building rich Internet applications in Adobe Flash, Flex, AIR, Silverlight then it's time to realize that these technologies are about to be overwhelmed by The JavaScript Tsunami. Once considered to be a lame language used for rollover effects, JavaScript is about to become the most important programming language of all.

OK, I overstated my point there, but it's important to realize that a confluence of events is raising JavaScript's importance. JavaScript is undergoing an Innovator's Dilemma pattern: it's a weaker language than Java and it isn't as graphically capable as Flash, yet it is growing fast because it works in the browser environment and because people are demanding fast, rich, browser-based applications.

Here are a few of the reasons:

1. The Web Browser Won

If you are writing a new user-facing application today your default should be to write for the web browser as the platform instead of for a specific operating system. Although there are painful differences between browsers, the web browser on a recent computer is fast enough for most of the applications that people use.

Although desktop applications may be necessary where very high-speed processing is needed (e.g. for an application like Photoshop), most people are doing mundane things with their machines (such as browsing the web, reading email, instant messaging, editing documents) and those things can be achieved in the browser.

Given the death of the Java applet, it's a choice between a plug-in (like Adobe Flash) or JavaScript. Since JavaScript is the native language of the browser its performance is likely to outstrip the plug-ins (this is especially noticeable at load time when plug-ins have to initialize). Ultimately, native languages talking to native APIs tend to win.

Even Microsoft, who was always a bit of an outlier in the JavaScript world, is falling into line with Internet Explorer 8.

2. The Browser Speed Arms Race

JavaScript speed is important. It's so important that the major browser producers are in an arms race to speed up their JavaScript performance. Google Chrome has their V8 JavaScript Engine, Apple Safari has SquirrelFish, Mozilla FireFox has TraceMonkey and Microsoft and Opera are both optimizing their JavaScript engines.

And there are performance benchmarks for comparing browsers.

All this means that JavaScript performance will continue to improve.

3. JavaScript Goes Pro

JavaScript is a laughably badly designed language. And many JavaScript developers are webmasters turned coders. It's the Perl of the 21st century.

Or is it just a language that's sufficiently different from all the others that it's misunderstood.

It's actually a bit of both, but as JavaScript: The Good Parts points out, "There Is Still Good in Him, I Can Feel It!". Inside the messy exterior there's a gem of a language.

As professional programmers come to understand JavaScript, the language, and examples of how to write JavaScript, will become professional.

4. The JavaScript Library Community

The JavaScript library community is large and vibrant, and it's free and open source. If you want to see the future of software it's usually best to go where the geeks go, and that tends to be open source projects where they can win respect through technical excellence.

And major companies are putting muscle behind these libraries with initiatives like YUI.

Compare that to the offerings in the Flash Exchange which are very commercial and focussed on designers not coders.

5. Adobe Flash is missing on the Android, BlackBerry and iPhone

Yet, JavaScript is present on all three without having to install anything. That means that your Flash application is automatically unavailable on the fastest growing web-based platforms out there.

If you are not trying to learn JavaScript now, you should be. JavaScript will be the web platform language and as libraries and implementations become faster and richer it will challenge and topple the plug-ins.

1 comment:

Me said...

I think you're being a bit too biased towards Javascript here.

I'm not aware of any benchmarks specifically about plugin start-up times versus javascript parsing times, so if you could point me to the actual data to backup the claim of js being faster there, I'd certainly like to see it.

Also, the javascript platform is still extremely limited in terms of APIs. It may be great to do more of what everyone else is already doing, but people pushing the envelope will still need other technologies.

PS. I just find it hard to believe in anything that says that "x will be the end of y", or any cheesy variations :P