Email: sales@altexsoft.com

Phone: (877) 777-9097

Request for Proposal
The good and the bad of web backend development with Node.js

The Good and the Bad of Node.js Web App Development

Being the most popular programming language, JavaScript is also one of the most universal software development technologies. Traditionally used as a web frontend development tool, it has also become a major cross-platform mobile development tool as a basic technology for a large number of platforms, such as Apache Cordova/PhoneGap, React Native, NativeScript, Appcelerator Titanium.

But the areas of application for JavaScript do not end here. Lately, there has been a lot of buzz around the use of JavaScript for server-side programming. One of the tools that indicated this shift in web development was Node.js.

The Rise of Node.js programming

What is Node.js? So-called Node.js framework is actually not a framework or a library, but a runtime environment, based on Chrome’s V8 JavaScript engine.

The technology was first introduced back in 2009 by Ryan Dahl at the annual European JSConf and was immediately recognized as “the most exciting single piece of software in the current JavaScript universe”.

As an open-source project, Node.js was sponsored by Joyent, a cloud computing and hosting solutions provider. The company invested in a number of other technologies, such as Ruby on Rails framework, and provided hosting services to Twitter and LinkedIn. The latter also became one of the first companies to use Node.js for its mobile application backend. The technology was later adopted by a number technology leaders, such as Uber, eBay, Walmart, and Netflix, to name a few.

However, it wasn’t until recently that a wide adoption of server-side JavaScript with Node.js started. The interest in this technology peaked in 2014, as per Google Trends, and remains high.

interest in node.js over time

Node.js strengths and weaknesses make it the subject of a heated discussion. To set the record straight, we have analyzed both – Node.js pros and cons – in an attempt to find out what projects can benefit from this technology choice. So, why use Node.js?

The Benefits of Node.js

⊕ Robust technology stack

JavaScript has proven to be an undisputed leader among the most popular programming languages. Node.js, in turn, is also gaining popularity, with 7 million users and an annual growth rate at 100%, as stated by 2017 Node.js User Survey Report.

Using Node.js for backend, you automatically get all the pros of full stack JavaScript development, such as:

  • better efficiency and overall developer productivity
  • code sharing and reuse
  • speed and performance
  • easy knowledge sharing within a team
  • huge number of free tools

Consequently, your team is a lot more flexible, the development is less time-consuming and as a result you get fast and reliable software.

Despite a common belief, with full stack web development you are in no way limited to the traditional MEAN (MongoDB, Express.js, AngularJS, and Node.js) stack. The only must-have in this case is Node.js (there is no alternative in JavaScript for backend programming). The rest of the technologies within this stack are optional and may be replaced with some other tools providing similar functionality (read about the alternatives in our separate article).

full stack javascript tools

⊕ Fast and event-based

What is Node.js used for? When using a common language for both client- and server-side, synchronization happens fast, which is especially helpful for event-based, real-time applications. Thanks to its asynchronous, non-blocking, single-threaded nature, Node.js is a popular choice for online gaming, chats, video conferences, or any solution that requires constantly updated data. The examples speak for themselves: many leading companies switched technologies to developed Node.js applications and noticed significant improvements – PayPal, for instance, noticed 35 percent decrease in response time since migrating from Java.

Not only does app performance benefit from Node.js’ lightness, the team’s productivity will increase as well. Developers trained in frontend JavaScript can start programming the server side with the minimum learning curve. With the same language on both sides, you can reuse code on front-end and back-end by wrapping it into modules and creating a new level of abstraction.

⊕ Scalable technology for microservices

Since it’s a lightweight technology tool, using Node.js for microservices architecture is a great choice. This architectural style is best described by Martin Fowler and James Lewis as “an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API.

Accordingly, breaking the application logic into smaller modules, microservices, instead of creating a single, large monolithic core, you enable better flexibility and lay the groundwork for further growth. As a result, it is much easier to add more microservices on top of the existing ones than to integrate additional features with the basic app functionality.

The difference between the monolithic and microservices architecture

Node.js is the technology of choice when building and deploying microservices solutions, according to the recent Node.js User Survey Report. About a half of the respondents are already using microservice-related technologies (namely, Docker, the leading software containerization platform) to build Node.js web apps:

Number of developers using docker with node.js

With each microservice communicating with the database directly through streams, such architecture allows for better performance and speed of application. Namely, Walmart’s shift to microservices architecture with Node.js resulted in the following immediate benefits:

  • Overnight 20 percent conversion growth in general and 98 percent mobile conversion growth
  • One hundred percent uptime on Black Friday (handling over 500 million pageviews)
  • Saving up to 40 percent on hardware and 20-50 percent on overall operations

Another bright example of how Node.js can outperform the competition in terms of performance is the case of GoDaddy. Running the SuperBowl ad campaign, the company was able to handle 10.000 requests per second without downtime, using only 10 percent of the hardware thanks to Node.js.

⊕ Rich ecosystem

One word – npm, a default Node.js package manager, it also serves as a marketplace for open source JavaScript tools, which plays an important role in the advance of this technology. With about 350,000 tools available in the npm registry as of now, and over 10,000 new ones being published every week, the Node.js ecosystem is quite rich. And it is actively used by developers, based on the number of weekly packages downloads.

rolling weekly downloads of npm packeages

Image source – http://blog.npmjs.org/post/143451680695/how-many-npm-users-are-there 

With such a vast variety of free tools accessible in a few clicks, there is a huge potential for the use of Node.js. At the same time, open source software enjoys a growing popularity as it allows you to build new solutions reducing the overall costs of development and time to market. The Future of Open Source Survey finds that 65 percent of respondents leverage such solutions to speed up the application development.

⊕ Strong corporate support

As mentioned above, the development of Node.js was supported by Joyent. In 2015, the Node.js Foundation was created to “enable widespread adoption and help accelerate development of Node.js.” IBM, Microsoft, PayPal, Fidelity and SAP became the founding members of the organization.

The list of organizations using Node.js in production is constantly growing. It currently includes almost three hundred well-known companies, such as PayPal, Medium, Trello, Uber and Zendesk.

Very few open source projects have ever enjoyed such strong support from the world’s leading companies. And that foretells Node.js has outstanding potential.

The Drawbacks of Node.js

Θ Performance bottlenecks and design issues

Two of the most argued about aspects of Node.js programming are its insufficiency with heavy computations and the so-called “callback hell”. Before we get into too many details, let’s figure out what’s what.

As we know, JavaScript (and, as a result, Node.js) is asynchronous by nature and has a non-blocking I/O (input/output) model. This means, it can process several simple tasks (for example, read/write database queries) queued in the background without blocking the main thread and do so quickly.

At the same time, Node.js is a single-threaded environment, which is often considered a serious drawback of the technology. Indeed, in some cases, a CPU-bound task (number crunching, various calculations) can block the event loop resulting in seconds of delay for all Node.js website users.

This represents a serious issue. That is why, to avoid it, it is recommended not to use Node.js with computation-heavy systems.

Due to its asynchronous nature, Node.js relies heavily on callbacks, the functions that run after each task in the queue is finished. Keeping a number of queued tasks in the background, each with its callback, might result in the so-called callback hell, which directly impacts the quality of code. Simply put, it’s a “situation where callbacks are nested within other callbacks several levels deep, potentially making it difficult to understand and maintain the code.

an example of source code with callback hell

Example of code with nested callbacks. Image source – http://callbackhell.com/

Yet, this is often considered a sign of poor coding standards and lack of experience with JavaScript and Node.js in particular. The code, represented above, can be refactored and simplified, in just a few steps, as shown at callbackhell.com.

Θ Immaturity of tooling

Although, the core Node.js modules are quite stable and can be considered mature, there are many tools in the npm registry which are either of poor quality or not properly documented/tested. Moreover, the registry itself isn’t structured well enough to offer the tools based on their rating or quality. Hence it might be difficult to find the best solution for your purposes without knowing what to look for.

The fact that the Node.js ecosystem is mostly open source, has its impact as well. While the quality of the core Node.js technology is supervised by Joyent and other major contributors, the rest of the tools might lack the quality and high coding standards set by global organizations.

Θ Growing demand for experienced professionals

Despite a common belief, not all JavaScript developers are Node.js developers as well. Mastering server side JavaScript programming requires a significant amount of effort and a certain background in backend development. Due to such a steep learning curve, the number of Node.js engineers is significantly lower than the total number of JS professionals.

As the hype over Node.js continues to grow, the demand for experienced professionals in this field increases.

the growth in node.js job postings as compared to other popular programming languages

Image source – www.indeed.com/jobtrends

However, a relatively new technology niche cannot meet this demand. The number of Node.js job postings is 3-4 times bigger than the number of job seekers with the relevant skillset.

number of jobseekers vs job postings for node.js as opposed to other popular programming languages

Image source – www.indeed.com/jobtrends

Thus, with millions JavaScript developers out there, it might be hard to find a skilled Node.js professional for your project. In this case, you certainly don’t want to limit your search to only one country. Sourcing technical talent overseas has long become the norm in the IT industry.

Node.js vs Ruby on Rails vs Django vs Symfony

There’s not a lot of technologies that can compete with Node.js’ popularity or market demand. However, if we look at the alternatives for server-side programming, we see at least three more shining stars in the sky. It’s Ruby on Rails, Django, and Symfony. Let’s see whether they hold up to Node.js’ benefits and share its drawbacks.

Comparing Node.js, Rails, Django, and Symfony stats
Source: StackShare

Ruby on Rails is known for its simple but opinionated language and the availability of gems – Rails’ own ecosystem of custom packages. Ruby itself is an intuitive and beginner-friendly language with a supportive and dedicated community that contributes code to RubyGems. Rails was created for rapid development and prototyping, though it’s successfully used by such brands as GitHub, Twitter, and Airbnb, proving its wide range of use cases. Its data migration functionality is especially impressive – unlike Node.js, which uses additional packages, Rails already has a feature allowing you to easily and consistently manipulate your database.

When should you use Rails over Node.js? Rails can’t compete with Node’s performance and scalability, however Rails can be a better choice for fast development. Node.js does have to use third-party modules to achieve that speed of development, but Ruby has it all unconventionally. As for the language, no tool has a distinct advantage – while Node.js has a high demand but low proposition, Ruby’s talent pool is initially smaller.

Django is a web framework on Python, the fastest growing programming language according to the data on StackOverflow. Marketed as a tool for perfectionists with deadlines, it’s created to make applications as fast as possible and in the most structured, secure, and easy to understand way. Django, along with Python, is also considered to have a milder learning curve. While working with Node.js will require an extensive knowledge of JavaScript, Django is a “batteries included” technology. It has a built-in admin panel to easily update and maintain your databases and templates to accelerate your work.

When should you use Django over Node.js? Compared to Node.js, Django is a beginner-friendly tool. Other than the language itself, there’s no real reason to choose one over the other. It’s more of a question about your comfort and experience with either JavaScript or Python than the specific use cases.

Symfony is a PHP framework which automatically provides it with 20+ years of documentation, and a massive, active community. More than 80 percent of the web is powered by PHP with projects like Facebook, Baidu, or any other website running on WordPress. While Symfony is just one of PHP frameworks on the market, it’s impressively stable, scalable, and works well for large-scale projects. It also uses a templating engine Twig that works akin to many PHP-based Content Management Systems.

When should you use Symfony over Node.js? Symfony naturally supports CMSs features such as templates and admin dashboards which allows it to run blogs, news sites, and eCommerce stores. Some of the examples include Yahoo Answers, Dailymotion, and National Geographic.

Make Node.js Shine

Obviously, with all the listed Node.js advantages and disadvantages, the technology is no silver bullet. But neither is Java, .Net framework or PHP. Yet, there are specific cases where each one of the listed technologies perform best. For Node.js, these are real-time applications with intense I/O, requiring speed and scalability.

This might be social networks, gaming apps, live chats or forums as well as stock exchange software or ad servers, where speed is everything. Fast and scalable, Node.js is the technology of choice for data-intensive, real-time IoT devices and applications.

Due to its non-blocking architecture, Node.js works well for encoding and broadcasting video and audio, uploading multiple files, and data streaming. The latter might be exceedingly useful for Travel industry software where you need to source data from different APIs of different suppliers.

Recently, Node.js has been actively used in enterprise-level software. While there is still much argument about this, many large companies and global organizations, such as Capital One and NASA, have already adopted Node.js. And the enterprise Node.js ecosystem continues to mature with such tools as IBM API Connect, Triton by Joyent, N|Solid by NodeSource, Red Hat OpenShift, Trace by RisingStack and others.

Yet, you can’t choose a language or tool just because another super-successful company did. It makes no sense to look at the others when your product and your business is at stake. You need to get your priorities straight and clearly identify the benefits the technology will give you, without forgetting about the hidden drawbacks. Hopefully, our “The good and the bad…” series will help you make the right choice.


This post is a part of our “The Good and the Bad” series. For more information about the pros and cons of the most popular technologies, see the other articles from the series:

The Good and The Bad of Xamarin Mobile Development

The Good and the Bad of JavaScript Full Stack Development

The Good and the Bad of ReactJS and React Native

The Good and the Bad of Swift Programming Language

The Good and the Bad of .NET Framework Programming

The Good and the Bad of Angular Development

The Good and the Bad of Selenium Test Automation Tool

3 Comments

Comments

Leave a Reply

avatar
Sort by:   newest | oldest
SS Raj
Guest
May 4, 2018
SS Raj

Great post! A well-written resource for anyone looking to boost their Node.js.

damiano
Guest
May 4, 2017
damiano

Callback hell stopped existing in 2015 with generators/yield and today we have async/await: there’s no nesting/callback anymore, js programming today is a piece of cake.
The problem is half of “pseudo node/js developers” out there do not keep themselves updated and keep coding with ancient ES5 standards thus we have the ecosystem bloated with sh***y modules/repos/libraries still using callback.
How do you spot a pseudo-js dev?
If he’s not using async/await (both on back-end with node 7+ or on front-end with babel) than he’s a pseudo-js dev.

AltexSoft
Member
May 11, 2017
AltexSoft

Thanks for bringing that up. There are many ways to avoid callback hell, including async/await. While it is definitely a must-know, not all developers (good developers) choose to use async/await operators. Namely, there are some drawbacks to consider https://medium.com/@benlesh/async-await-it-s-good-and-bad-15cf121ade40
However, as mentioned in the article, the issue has never really existed for skilled JS developers.