A couple of years ago, the development team at AnyPresence was tasked with implementing a back-end server API generator for a large customer that wasn’t comfortable using Ruby on Rails in production and preferred an option in the Java ecosystem. To meet this requirement, the AnyPresence platform team invested a significant amount of time implementing a Java version of the generator in the Play framework. However, it was taking too long to implement features to match what was already available in the Rails version, so the team eventually started to look at alternative frameworks.
That search ultimately led us to adopt Node.js and Sails.js, which is an MVC framework for Node.js. This article attempts to explain the reasoning behind these choices.
Problem No. 1: Java, .Net, or Node.js?
As an enterprise dev platform for Web, mobile, and IoT apps, AnyPresence needed a secure, scalable, and well-supported development framework and runtime environment that could be used in large-scale production scenarios. Java and Microsoft .Net were the obvious options. Given Java’s rock-solid foundation, IDE support, threading capabilities, debugging features, and vast array of libraries, it is still regarded by many as king in the world of programming. But Java has its downsides, primarily related to speed of development and the burden of legacy overhead, making it a questionable choice when it comes to modern, streamlined Web app development.
Microsoft .Net also has a huge following in the enterprise, but adopting .Net would require picking a specific .Net language like C#, and that would mean alienating the large swath of Java developers. Given these challenges, AnyPresence considered Node.js, which had a strong following with an impressive amount of documentation, tools, and best practices considering its age, and it was rapidly gaining adoption among enterprise IT organizations.
With further research, the AnyPresence team concluded that Node.js was the best option for both technical and business reasons. The three main reasons:
- Node.js offers speed and a nonblocking I/O API. Node.js was created because concurrency is difficult in many server-side programming languages, and often leads to poor performance. Node.js provides an event-driven architecture and a nonblocking I/O API that optimizes an application's throughput and scalability. Developers write simple code and Node.js takes over. Node.js uses an event loop, instead of processes or threads, to scale. Callbacks are defined, and the server automatically enters the event loop at the end of the callback definition. Node.js exits the event loop when there are no further callbacks to be performed.
Sign up for CIO Asia eNewsletters.