JavaScript conquers the server

Node.js, Jaxer, EJScript, RingoJS, and AppengineJS combine the familiarity of JavaScript, low overhead, blazing speed, and unique twists

By Peter Wayner, InfoWorld |  Software, java, JavaScript

Fear not. If this happens, Node.js lovers will blame you, not the machine. Your job as a programmer is to anticipate any delays, such as a request for a distant Web service. Then you break your code into two functions, just as AJAX programmers often do on the client. When the data is returned, Node.js will invoke the callback function. In the meantime, it will handle other requests.

In the right hands connected to a right-thinking mind, the results can be staggeringly efficient. When the programmer spends a few minutes and separates the work done before and after a delay, there's no need for the machine to tie up RAM to hold the state in the thread just so it will be ready when the data finally shows up from the database or the distant server or even the file system. It was undeniably easier for the programmer to let the computer keep all of the state, but it's much more efficient this way. Just as businesses try desperately to avoid tying up capital in inventory, a programmer's job is to think like a factory boss, treat RAM as capital, and avoid consuming any of it.

This mind-set may seem like a burden to programmers who are used to letting the compilers think about such things, but JavaScript programmers are accustomed to working with callback functions because that's how the browser's sandbox is configured. This kind of segmentation is second nature to them, and that's why they're so in love.

I think Node.js will quickly grow beyond doing simple experiments and begin to handle semiserious but lightweight tasks such as online polls and simple message passing between users. If the server workload is simple and short-lived, Node.js is a good solution. The tools are solid, at least as experimental, bleeding-edge code goes, and I expect that skilled JavaScript programmers will be able to write simple chains of callbacks that do some amazing things with low-rent iron. Will bigger responsibilities follow? I suppose that's possible, but for now this is enough for everyone to digest.

JavaScript servers: Jaxer Another, completely different option for the JavaScript lover is Jaxer, a nice tool from Aptana, the folks who make a great, Eclipse-based IDE for Ruby and PHP. Aptana's tool for server-side Java is very different from Node.js because it's aimed more at making life easier for the programmer rather than the server. Jaxer handles all the complexity of message passing behind the scenes, so writing server-side code is like writing client code.


Originally published on InfoWorld |  Click here to read the original story.
Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Spotlight on ...
Online Training

    Upgrade your skills and earn higher pay

    Readers to share their best tips for maximizing training dollars and getting the most out self-directed learning. Here’s what they said.

     

    Learn more

SoftwareWhite Papers & Webcasts

See more White Papers | Webcasts

Answers - Powered by ITworld

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Ask a Question
randomness