Eric Knorr
Contributing writer

The triumph of JavaScript

analysis
Sep 23, 20135 mins

JavaScript is eating the world, with new tools and enhancements arriving at a breakneck pace. Is it time to accept the inevitable?

Remember the days when some people, concerned about security, would disable JavaScript in their browsers? Today that seems like a ridiculous notion. JavaScript rules the Web.

In a computing era marked by a wild diversity of platforms, we need apps that can run on any device with a browser. Native apps may run faster and exploit platform-specific features JavaScript can’t touch, but we’re already living in a cloud world. Are you going to write a desktop or mobile app that runs on just one platform, or write one in JavaScript that anyone can use?

Of course, the answer to that question depends on the nature of the app. JavaScript has obvious limitations — for security reasons JavaScript can’t read or write files on the client, for example, and “real” programmers like to hammer on a slew of shortcomings. But JQuery and a host of other frameworks have made JavaScript much more practical for building complex applications, while JSON (JavaScript Object Notation) has all but supplanted XML for data transmission. Not to mention that Node.js, which just won another InfoWorld Bossie award, has provided a powerful way for JavaScript to address the server side.

How far can JavaScript be pushed? By coincidence, the two most recent posts in InfoWorld’s New Tech Forum both talk up the potential of JavaScript: One by Dan Bricklin, a guy known to graybeards as the co-creator of VisiCalc, and one by Divya Manian and Thibault Imbert of Adobe.

In “JavaScript beats native code for mobile,” Bricklin calls into question the assumption that JavaScript executes slower than native code:

While it’s true that for general computation of mathematical operations native code should be able to run circles around JavaScript (and compute those circles while doing it), that viewpoint ignores the fact that far different operations are performed in many apps and JavaScript-based apps often equal or beat native code for those operations.

Why? Because, Bricklin says, very smart programmers have been tweaking browsers for years to optimize the speed of those operations. Plus, progress is being made as we speak in more advanced in-browser operations such as 3D rendering. (Plug: Don’t miss a comparison of JavaScript data visualization frameworks that InfoWorld will post next Wednesday.)

Writing on behalf of Adobe, Manian and Imbert peer into the future of JavaScript and call out the Mozilla research project asm.js, which “defines a subset of JavaScript that can be generated by compilers and highly optimized by JavaScript VMs.” More exciting is their exploration of RiverTrail, a parallel programming model and API for JavaScript developed by Intel. The authors also talk about new HTML5 features Adobe is proposing to standardize, including Regions, Blend Modes, and Shapes.

It scarcely needs to be said that, by implication, Manian and Imbert’s post throws another shovel of dirt on the grave of Flash and ActionScript.

The JavaScript ecosystem The triumph of JavaScript seems to have inspired the launch of a new framework every week, as well as other tools associated with JavaScript coding. Along with jQuery and Node.js, this year’s Best of Open Source Software Awards showcased seven JavaScript winners:

  • AngularJS, a toolset for turning static HTML pages into JavaScript applications, with support for MVC architecture
  • Backbone.js, a JavaScript library that enables developers to add structure to apps and represent data as Models
  • Bootstrap, a responsive Web design framework intended to be used in conjunction with JQuery
  • Enyo, an object-oriented JavaScript framework that can be used to build HTML5/CSS apps
  • D3, a JavaScript library that pushes vector graphics about as far as it can go in the browser, no plug-ins necessary
  • Ember.js, an up-and-coming JavaScript framework for developing MVC applications with rich functionality
  • Emscripten, a compiler that converts C++ into asm.js, Mozilla’s highly optimizable subset of JavaScript

That’s quite a toolbox — and these represent only the cream of the crop of what’s available. The explosion in these tools, most of which are open source, continues to fuel JavaScript’s momentum.

But … JavaScript?? Nonetheless, experienced developers remain a little queasy. InfoWorld’s Andy Oliver articulates his reservations this way:

All JavaScript, all the time is entirely possible — you just need to decide for yourself whether it’s a good idea … The manager in me loves the idea of being able to have a pool of developers who can do jQuery, Node.js, and maybe light database work on MongoDB. The developer in me cringes at the idea of spending my days writing JavaScript … The project lead in me cringes at the thought of a bunch of JavaScript developers even thinking about my precious database.

In other words, both easy to learn and somewhat awkward, JavaScript democratizes programming — which will lead to messed-up code written by people who don’t know what they’re doing.

But there are also growing ranks of good JavaScript coders, many of whom will run close behind such advancements as asm.js or Intel’s RiverTrail parallel programming model. They certainly won’t suffer from a lack of tools to pursue their craft.

Of course, there are also JavaScript alternatives, led by Google Dart, which is due for a formal 1.0 release sometime soon (see “First look: Google Dart vs. JavaScript“). But Dart code needs to be compiled to JavaScript to run in any browser except a special version of Chromium equipped with the Dart virtual machine.

The best doesn’t always triumph. As with the x86 instruction set, sometimes the winner just happens to be the last platform standing. I have no idea how JavaScript can extend itself to enable developers to build, say, applications with the accumulated richness of a Microsoft Office. But strange as it may seem to see the future through a browser window, I wouldn’t bet money against it.

Eric Knorr

Eric Knorr is a freelance writer, editor, and content strategist. Previously he was the Editor in Chief of Foundry’s enterprise websites: CIO, Computerworld, CSO, InfoWorld, and Network World. A technology journalist since the start of the PC era, he has developed content to serve the needs of IT professionals since the turn of the 21st century. He is the former Editor of PC World magazine, the creator of the best-selling The PC Bible, a founding editor of CNET, and the author of hundreds of articles to inform and support IT leaders and those who build, evaluate, and sustain technology for business. Eric has received Neal, ASBPE, and Computer Press Awards for journalistic excellence. He graduated from the University of Wisconsin, Madison with a BA in English.

More from this author