And now, let’s discover that.
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.
The rising popularity of Node.js is easy to understand, as
more companies seek full-stack developers and more developers leverage
existing skill sets for back-end server coding. Node.js allows for
developers to write JavaScript on both the client side and the server
side. That means you can use the similar patterns and — in some cases —
the same libraries for both back-end and front-end development. That’s a
big win when it comes to developer productivity, maintenance, and time
to market.
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 is a politically neutral language. While
philosophical debates and stubborn adherence to “standards” tend to
drive a wedge between the Java and .Net camps, Node.js is quickly
becoming the Switzerland of programming languages. Node.js is generally
accepted and understood by both Java and .Net camps, whose developers
are comfortable with JavaScript syntax and are able to deploy Node.js on
both Unix and Windows infrastructures.
-
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.
-
Node.js is ready for enterprise deployment. Node.js
appeals to a wide range of the tech community because it has a
reputation for scaling well, being secure, and being easy to learn. It’s
not hard for a developer to pick up JavaScript and quickly become
productive with it. There are many well-known organizations using
Node.js in production, including PayPal, LinkedIn, Netflix, and the New
York Times.
Problem No. 2: Choosing a Node MVC framework
After AnyPresence decided on Node.js, we faced the question
of which MVC framework to select. The top five we considered included
Express.js, Meteor.js, Sail.js, Derby, and SocketStream. Ultimately, we
chose Sails.js for its permissive license, robust community,
flexibility, and readiness out of the box.
AnyPresence is architected with separation between design
and runtime environments. The platform provides developers with full
access to the source code across the entire application stack.
Therefore, an ideal framework for us would have a permissive open source
license based on MIT or BSD, enabling modification and distribution
without sacrificing confidentiality of proprietary components. Sails.js
comes with the MIT license.
Sails.js boasts a large and active community on
GitHub,
with thousands of people who either follow the repository or who have
forked it. Such a large following indicates solid adoption from the
community, which ensures a more mature and robust product.
While being very full-featured out of the box, Sails.js is
based on Express.js, perhaps the most pervasive Node.js application
framework in existence. As a benefit, any Express-based middleware can
be plugged into Sails.js and utilized, giving Sails developers access to
hundreds of open source packages that run on the Express.js platform.
Finally, because Sails.js comes with so many basic features
out of the box, we immediately got many capabilities we wanted without
having to reinvent anything. These included the following features:
-
Waterline ORM. Waterline was the perfect ORM
for us, as the team could write a pluggable database adapter to connect
to many different systems. Some frameworks only allow for relational
databases or specific NoSQL databases such as MongoDB. If you wanted one
for SOAP, you had to use a different solution. Having one layer to
connect to different data sources was key for AnyPresence.
-
A plethora of database adapters. Adapters are
available in the Sails.js community for MySQL, MongoDB, PostgreSQL,
Redis, and Microsoft SQL Server. This was important for the AnyPresence
platform because being able to use a single framework regardless of the
back-end data store makes life much simpler.
-
Rapid and agile development. With Sails.js,
it’s very quick and easy to get stuff up and running using prototyping.
You can iterate more quickly. It’s easy to view and test changes, which
is not the case if you are developing with Java or .Net. Enterprise Java
development, for example, is very bloated and cumbersome compared to
development with Sails.js. Using Sails.js, developers are more
productive due to the shorter code/test cycle.
There are many factors to consider when choosing a platform
for your enterprise applications or customers. When AnyPresence debated
the adoption of Java, .Net, or Node.js for our enterprise development
platform, the decision wasn’t obvious or made overnight. In the end, the
scalability, speed, enterprise readiness, and community support of
Node.js swayed our engineers.
If you’re building your next-generation applications —
especially APIs for mobile and Web integration in IoT — or if you are
creating something new that depends on those underlying services,
Node.js is a runtime system that could very well work for you. It has
certainly worked well for AnyPresence and its customers.
Rick Snyder is a software
engineer and architect with more than 11 years of experience developing
enterprise software. His particular interests include middleware,
concurrency, scalability, and performance. Snyder is currently director
of engineering at AnyPresence,
an enterprise platform for digital transformation that enables API
microservices, enterprise mobility, and IoT app ecosystem initiatives.
Comments
Post a Comment