未加星标

Rails vs NodeJS ― the comparison

字体大小 | |
[前端(javascript) 所属分类 前端(javascript) | 发布者 店小二03 | 时间 2016 | 作者 红领巾 ] 0人收藏点击收藏
Rails vs NodeJS ― the comparison
Rails vs NodeJS ― the comparison
source: https://bsdmag.org

There are thousands of articles on the web regarding these three words. So why am I writing about this?

Answer: None of the answers could satisfy me.

I have worked with NodeJS as well as RoR and implemented the same server using both the technology stacks. So, here are some pros of both the stacks.

Lets clear something first (And hard code this in your brain’s neural net)

NodeJS is a Runtime Environment for running javascript as a server.

Rails is a Framework for Ruby Language.

Pros ofNodeJS

NodeJS is blazing fast.

You can see this line everywhere on the web. Literally everywhere. So here too. Why? Because it just is. It is really fast for what it is intended for.

1. LearningCurve
Rails vs NodeJS ― the comparison

As the name suggests, codes in NodeJS are written in JavaScript . Hence, for those with prior experience in front-end development can easily learn NodeJS. It is easier to write code even for those who are coming from C/C++ or JAVA background.

Rails is similar to python, it has no brackets or semi-colons which many C++/Java developers are uncomfortable with.

2. Flexible project structure
Rails vs NodeJS ― the comparison

Rails wants a definite file and folder structure. Its architecture is such that it looks for file in particular locations only. It is like all our Mothers. They need to have their items exactly in the places where they wants. Move any file from one directory to another and rails go HAVOC .

NodeJS, on the other hand, is very flexible ― You can put all your code in just one file or in many directories. Its completely upto you how you want to manage it.

3. No strict filenames

One problem with Rails is that changing a filename will crash the server. Suppose there is a controller for ‘ User’ model in your project, Rails will name the controller file as user_controller.rb . Now if you change this file name, Rails will crash. This is because it implicitly imports files by looking up filenames based on its internal logic.

NodeJS on the other hand has no such limitations. You can name your files user_controller.js or userController.js or UC.js or u_controller.js or anything else. NodeJS is cool with it. You just need to require the files wherever you need to use them.

Pros ofRails 1. Multithreaded

Ruby is multi-threaded in its operations in contrast to NodeJS which makes it much better for CPU intensive operations.

NodeJS is single threaded and was designed for heavy I/O bound applications and is great in this domain. BUT when it comes to heavy computing requirements, NodeJS is terrible.

2. No callbacks

In ruby, all the instructions are executed sequentially. i.e the processor waits for the result of the current line operation before jumping over to the next line. This makes ruby a good scripting language.

NodeJS functions asynchronously. For most of the programmers coming from any other language, callbacks are something from the dark world.

3. Code Maintenance
Rails vs NodeJS ― the comparison

Ruby on Rails follows coding conventions that make them simple to go from one developer to the next. Your hair will be thankful, as you’ll no longer be pulling it.

NodeJS can be tricky. You can put your code in any file you want which can create problems when handing over your code to some other developer.

Bonus Comparisons of different back-end technologies:
Rails vs NodeJS ― the comparison
No. of concurrent clients that can be handled, Source: hachrocket.com
Rails vs NodeJS ― the comparison
Memory usage by web server in different languages, Source: hachrocket.com

As evident from the graphs, there is a tradeoff between the ease to code and performance of server.


Rails vs NodeJS ― the comparison
Module count comparision of NodeJS vs Rails, Source: http://www.modulecounts.com/

Also from the module count graph above, we can see that NodeJS has more modules than Rails. The community support NodeJS modules has increased exponentially.

Takeaways Why we should use NodeJS. Why we should use Ruby on Rails.

Rails is for CPU intensive operations WHILE NodeJS is for IO intensive operations.

Don’t forget to Recommend & Share:)

Please click the “Follow” button to learn easily via “The Bit Theories”

Team Cyber Labs ( Website , Facebook )

本文前端(javascript)相关术语:javascript是什么意思 javascript下载 javascript权威指南 javascript基础教程 javascript 正则表达式 javascript设计模式 javascript高级程序设计 精通javascript javascript教程

分页:12
转载请注明
本文标题:Rails vs NodeJS ― the comparison
本站链接:http://www.codesec.net/view/483237.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 前端(javascript) | 评论(0) | 阅读(29)