Node.js – Powering The Real-Time Web
The Agency’s tech team is constantly looking for new ways to leverage web technologies in our work. For the past year we’ve been keeping a close eye on Node.js.
So what’s the big deal? As RIAs (rich internet applications) become bigger, badder and bolder, developers need solutions that are not only device agnostic, but that scale dynamically.
One of the key packages/modules that you can use with Node.js (along with the plethora of other open-source packages available) is async (asynchronous processing). Asynchronous meaning that when the application performs a task, we don’t have to wait for the operation to finish before moving onto something else (a bit of an oversimplification, but this is the core idea).
Web servers and GUIs typically deal with read/write (IO) operations in sequence, meaning if your web application happens to need to do some heavy number crunching, operations requested subsequent to this need to wait. With Node.js, your app can continue executing those subsequent operations, then come back when the result is made available. Here’s a good overview of async that goes into a little more detail:
Where can Node.js be used effectively? Typically, operations that require a persistent connection with frequent updates can benefit most from the way Node.js works:
– Chat based applications
– Dashboards (financial / stocks / sports / betting)
– Dev ops (server status / uptime)
Node.js is rapidly gaining traction in enterprise-level businesses, who are embracing the framework to power their RIAs – often in very different industries. In fact, some commentators are touting the framework as having made the jump from fashionable new tech to mainstay corporate asset.
Indeed, the user list for Node.js includes companies like eBay, LinkedIn, Paypal, New York Times, Groupon and Myspace (yep, still going).
On the other hand, the ‘long tail’ of projects using the framework is extensive:
Why then, would anyone not use Node.js? It’s important to note that the framework is not a panacea for web development – fervent debate on the use/misuse of Node.js has been circulating the web for a while now. One crucial misunderstanding abounds, which is that Node.js can speed up number-crunching operations. One of the best overviews of the debate is here:
A big critique of the framework is that in order to leverage async benefits in particular, developers end up writing code in what’s been termed “callback hell”, with hard-to-read nested levels of code needs for otherwise fairly simple functions. This can, however, be managed in a number of ways:
Node.js certainly fulfills a specific need – to handle real-time RIAs requesting and pushing data – and there’s a very good reason that enterprise clients are embracing Node.js: it can deliver fast, scalable applications.
Where do we go from here?
If you’re interested in diving into Node.js, there are a plethora of tutorials and resources out there, but I’d like to highlight one in particular that I found really useful when starting off with Node.js: http://nodeschool.io/
Lastly, if there’s one thing that should recommend Node.js to you, it’s this:
Any framework that can handle programming flying robots must surely be worth a look.
Do you have any thoughts on Node.js? Get in touch @gencyuk.