Node.js has become wildly popular, with coders everywhere using it to create APIs and build a new matrix of interoperability across the Internet. Joyent has been the chief sponsor of Node.js from the beginning. In this week's New Tech Forum, Ben Wen, vice president of product marketing at Joyent, outlines six things you should know about the phenomenon shaking up backend development. -- Paul Venezia
At it's core, Node.js is a stripped-down, highly customizable server engine -- a proto-server, if you will -- because out of the box it doesn't do anything until you set it up. This proto-server processes in a loop, ready to accept and respond to requests. Any of those requests themselves may initiate other requests to some other part of the system, such as to read a file off of disk or to send a signal to spin a motor on a robot arm. That loop, known as the event loop, is the "runtime" part.
In short, Node.js is a runtime system that makes it easy to build a network or other event-driven application servers. Here are the six things you need to know about it.
1. JSON has won
3. Sharing is encouraged
The ethos of the Node.js community is "share gleefully." It's frighteningly easy to share packages of library code -- technically, culturally, procedurally, and legally. The Node Package Manager is included with Node.js and has grown to a repository of nearly 50,000 packages, making it likely that another developer has already packaged up a solution to your problem, or even some less common ones.
Node.js' namespace philosophy is essentially the absence of one, letting any author publish under an unused module name in the shared public repository. Sharing code under the MIT open source license is highly recommended in the community, which also makes cross-pollination of code relatively worry-free (and lawyer-free) from an intellectual property perspective. Finally, the community is highly engaged in binding interesting C libraries like computer vision (OpenCV) and the Tesseract open source optical character library. The latter, for example, makes possible weekend projects like Imdex that process images from the Web so they can be automatically searched for written content.
4. Node Package Manager works broadly
Speaking of managing library dependencies, the Node Package Manager deserves to be called out. Node Package Manager is the root of almost all deployment systems for Node.js and underlies the many PaaS (platform-as-a-service) providers for Node.js, actually making it somewhat easy to move smaller applications between providers. Its simple, dependable package management has let the Node ecosystem grow extremely well in recent history, to the point that the underlying public service now needs to scale to the next level.
5. 'Batteries not included' minimalism
Node.js applications and Node.js Core itself are broken down into small modules that are composed and shared. Each package and tool can be scoped tightly and crafted to be manageable. These can then be baked together -- often without too much unnecessary kneading. The low-barrier, carefree nature of creating a module also encourages experimentation in the community, and there's quite a bit of overlap and experimentation in the package population. When executed well, each package typically handles one task (e.g. node-optimist.js: 'light-weight [command-line] option parsing').
Finally, Node.js is well instrumented for production usage. What that means is that there are the tools to help bring an application to full production readiness and performance. As with any maturing technology, there are areas where more documentation, tools, and best practices could be helpful. But as Node.js heads towards its next major release, it's on fairly solid footing.
Node in context
Where does Node.js not work so well? It's not totally appropriate in places where a single-threaded calculation is going to be the holdup, like some kinds of successive approximation or classification. In those instances, it's more efficient for Node.js to drop the request to an independent library that's dedicated to the task, where it can be distributed across hundreds or thousands of processors.
Node.js is maturing quickly and is being deployed in more and more mission-critical and revenue-critical systems, such as eCommerce Black Friday infrastructures. It's easy to get started with Node.js, and yet Node.js is deep enough to handle modern Web complexities. If you're building your next generation Web site -- especially APIs for mobile and Web integration -- or if you are creating something new that depends on underlying services itself, Node.js is a runtime system that could very well work for you.
New Tech Forum provides a means to explore and discuss emerging enterprise technology in unprecedented depth and breadth. The selection is subjective, based on our pick of the technologies we believe to be important and of greatest interest to InfoWorld readers. InfoWorld does not accept marketing collateral for publication and reserves the right to edit all contributed content. Send all enquiries to email@example.com.
This article, "6 things you should know about Node.js," was originally published at InfoWorld.com. For the latest business technology news, follow InfoWorld.com on Twitter.
This story, "6 things you should know about Node.js" was originally published by InfoWorld .