When I first tried Node.js it was like a breath of fresh air. I could write the entire application in one language. Also, the early tools from the developer community made it easy to build discrete, small and testable modules. Though modules are a foundation of the other environments, Node.js and npm (Node's command-line dependency manager) seemed to address the many things I disliked about those systems.
The Node.js tools and community have grown since then, but the core philosophies are still there. Most importantly, there are many ways to approach solving any particular problem. In my previous article Getting Started With Node.js I discussed what Node.js is, where it came from, and how early enterprise adopters are using it. In this piece I hope to inspire you to take a further look at Node.js and consider it for your next project.
A Growing Talent Pool
So, you have committed to a new project. Maybe you are the developer and realize that your current tool belt does not satisfy all your needs, or perhaps you just want to learn something new. Alternatively, you are the startup mastermind preparing the job description to attract a "rockstar" developer or technical cofounder to your small but growing team.
The Union of Client and Server
There are many tools available on npm that make it easy to get up and running quickly. A good starting point would be the Express web application framework and Mongoose ODM for data modelling with MongoDB. They impose very little structure or organization on the project and give the developer free reign to explore and implement a style that is most comfortable. Furthermore, if you are a self-taught newcomer to Node.js and asynchronous programming, these tools prove to be extremely valuable resources.
Getting the Most from Multi-Core Hardware
Some applications, particularly in the enterprise, require the high memory capacity or multi-threading of the Java Virtual Machine (JVM). The JVM offers quite an advantage on modern hardware with multiple core processors. Because of this, some developers shy away from Node.js once they discover that it does not inherently support multi-threading; A single Node.js process is a single thread.
Node.js has a time and a place. One scenario to examine is a web or RESTful application which requires support for a large number of concurrent requests. Included in Node.js is the "cluster" module which will allow any web server process to be forked into multiple processes all sharing the same port. It is then left to the operating system to handle load-balancing. Those interested in learning more should visit the Node.js Cluster API Documentation.
The other scenario that usually warrants increasingly complex systems is long running utilities. While Node.js' asynchronous model shows performance gains when reading and writing databases, making requests to third-party APIs and doing filesystem IO, not all operations belong in the same thread. Complex operations such as encoding media have no place in the same process as the web server. Rails applications solved this issue long ago with background queues and Node.js has followed suit. Tools such as Kinetik are invaluable in complex applications. Some Rails developers have begun to migrate their background processing to Node.js for increased throughput.
Choosing the right tools is vital and so is choosing the right talent. So as you plan your next big web application, interview your next hire, or commit to a weekend to a learning a new skill, ask yourself what you hope to accomplish. Hopefully the answer is that now is the perfect time to give Node.js a try!