Watch out Java, here comes JavaScript

Once a lightweight browser scripting language, JavaScript is making a resurgence on the server

Page 2 of 2

The CommonJS project seeks to address these issues. Its goal is to create a set of open, standard APIs for such functions as binary object handling; concurrent threading; file, stream, and socket I/O; system logging; and so on. In addition, it has proposed a standard module format for code libraries and their accompanying namespaces. It's a young project yet, but the eventual idea is that JavaScript programmers will be able to write code to the CommonJS specifications and have it run unmodified on any CommonJS-compliant platform, regardless of its underlying JavaScript engine or OS.

Even more exciting, however, is Node.js, which builds on similar ideas to CommonJS and implements some CommonJS APIs. However, it takes the concept of SSJS to a new level. Its most important innovation is its implementation of an event-oriented programming model for server-side development. That means not only will Node.js programming feel very familiar to client-side JavaScript developers, for whom the event-driven model has become the norm, but it's also ideally suited to Web applications, which rely heavily on parallelism to support multiple concurrent users.

If that sounds like so much hand-waving to you, just consider the Node.js code samples. Its equivalent of "Hello, world!" is a fully functional HTTP server implemented in just six lines of JavaScript.

JavaScript: King of the Web?
Don't expect JavaScript to topple Java from its throne just yet. There's a lot of work to be done on both CommonJS and Node.js, and it would be accurate to describe both projects as experimental. What's more, the specific optimizations and management tools that come with Oracle's JRockit JVM, for example, will make Java an attractive platform for enterprise software development for some time to come.

Still, the benefits of JavaScript as a server-side language are clear and striking. It allows Web application developers to implement their entire code base using a single syntax, reducing the clutter and confusion of typical Web apps. JavaScript's performance is increasing at a breakneck pace, which has built-in benefits for developers. Its event-driven programming model makes building parallel applications easy and logical. And JavaScript itself has matured into a fine language, with features that support both the object-oriented and functional programming styles.

There's something else worth considering: JavaScript is completely free and open, maintained by an ECMA standards committee based on contributions from vendors across the industry. While the ECMAScript working group has become deadlocked in the past, it has largely managed to overcome those problems, and the evolution of the JavaScript language continues apace. Meanwhile, Java, while ostensibly open, remains burdened by the somewhat dysfunctional Java Community Process, and now by the threat of potential lawsuits from Oracle. If Oracle doesn't recognize this distinction, developers surely will.

This article, "Watch out Java, here comes JavaScript," originally appeared at InfoWorld.com. Read more of Neil McAllister's Fatal Exception blog and follow the latest news in programming at InfoWorld.com.

| 1 2 Page 2
From CIO: 8 Free Online Courses to Grow Your Tech Skills
Notice to our Readers
We're now using social media to take your comments and feedback. Learn more about this here.