Rails vs. NodeJS: All Good Things Must Come to an End


If you’ve ever spoken to developers you can be assured of one thing: they are very argumentative when it comes to the programming language they like and the framework they prefer for it.

Go to a tech meetup and you’re bound to find at least two developers arguing over whether NodeJS or Rails or .NET is the best framework to use. This often leaves individuals new to web app development wondering what to learn and somewhat worried about making the wrong choice.

Every framework has it’s up’s and downs but I’m going to make the case right now for why developers need to move away from Rails and make the effort to learn NodeJS.

For starters, what is a framework? A framework is a library of pre-assembled files that simplifies the amount of code you need to write to build an application in a specific language. Rails is a framework for the programming language Ruby and NodeJS is a framework for the programming language JavaScript. To use any of these frameworks you need to at least know how to code in the base language it is built around.

The first point in NodeJS’s favor is that JavaScript is the most widely used programming language in the world. Learning to use NodeJS means learning JavaScript and once you know JavaScript you open up yourself to an expansive world of development options, including the other very popular front-end framework, AngularJS.

Ruby thrived in its early days because it made learning to code much easier for new developers. Programming has always been an intimidating vocation because of how complex it can be to understand the way computer scientists choose to describe programming concepts. Rails took these ideas and allowed developers to represent them with more natural language, i.e the way you speak. This made it much easier for newbies to jump into programming and build apps.

Rails helped usher in the current development landscape because it brought programming to a whole new market; the non-computer scientist developer. Web applications rapidly proliferated across the Internet and independent developers began to solve the types of problems typically reserved for the software giants. Unfortunately for Rails, the new technology era it inspired will also be what destroys it.

As the Internet grew more powerful and browsers like Chrome began to push the envelope of what web applications were capable of, technology evolved and adapted. In the era when Rails was on the rise, servers were responsible for passing web pages to the end user trying to read them; i.e. you. With more and more people jumping online servers began to feel the strain of an increasing number of page requests.

The improved appearance and functional expectations of web sites also meant that each page request was increasing in size because more CSS and JavaScript needed to be sent along with the HTML from the server. With more and more users online, web applications began to slow down. The cost to operate servers and the number required rose to keep the applications running quickly. What developers began to realize was that web applications needed to be looked at differently in order to meet the increasing bandwidth demands on servers.

NodeJs was built from the ground up to meet the needs of modern web applications. At their core, websites are just handling multiple input and output interactions. Essentially user clicks on something like playing a song and the song plays. The types of things web applications were asked to do did not involve running complex algorithms and so they were not using up a ton of CPU power. All that they were doing was running a bunch of short quick little process on the CPU to grab a few files, or some data from a database, and send it to a user.

This is like a queue to get coffee; even though it’s a quick pour to fill a cup, if 1000 people just show up at once the line can take an eternity to clear. NodeJS is designed to rapidly respond to these increasing queues by facilitating faster responses to short little requests, like getting a page from a server.

This subtle change in how the framework operates on the CPU level is not just a differentiator of NodeJs from Rails, it’s also a differentiator from how frameworks like Django (built on python) and .NET (built on C#) work. The change has led numerous developers to adopt NodeJs over Rails to save on server costs and bandwidth consumption. In fact, as of July 2014, the number of developer packages for NodeJs has surpassed Rails.

NodeJS has also ushered in a paradigm shift for how web applications should be built. This article on TechCrunch expresses that need in the form of API driven design. API’s are something that both Rails and NodeJS support, however, unfortunately for Rails, NodeJS preforms orders of magnitude better for large user bases. It is so quick it even allows for real time changes of data on websites.

Every framework has its pros and cons and anyone that is zealot for one maybe just hasn’t spent enough time working in the others. I have no animosity towards Ruby, it is an excellent framework, but just like gas-powered vehicles, all good things must come to an end.