Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clarifications about Rails and Node.js

Up to now I've always used PHP with or without a framework but a month ago I decided to start something new: Ruby and Rails, I found them quite easy and similar to PHP and some PHP frameworks in how they works but using a simpler syntax and many other advantages.

Some days ago I started reading about Node.js, Node.js vs Rails, "why node.js is better"...

I'm a bit confused but my objective is to learn something modern that will not become obsolete in a few months so:

What are the main differences between Rails/Ruby and Node.js and a framework based on it like Express.js (except that one is written in JS and the other in Ruby)?

What are the main advantages/disadvantages of using Node.js and framework based on it instead of a Ruby based solution like Rails?

Thanks!

like image 674
Matteo Pagliazzi Avatar asked Mar 06 '12 14:03

Matteo Pagliazzi


People also ask

Why is node better than Rails?

Node. js is very flexible and can do things out of the box, but you will have to write some code and install some modules. Ruby on Rails is not a flexible framework and makes you adhere to its way of doing things out of the box. You have to build your app in a particular way.

Should I learn node js or Ruby on Rails?

If you're building a CPU intensive application, you should choose Ruby on Rails, because Node. js is not the solution here. It can result in significant performance issues if your application has to process images or render graphics. These processes need multiple CPUs.

Is node js used in frontend backend or both?

Node. js is sometimes misunderstood by developers as a backend framework that is exclusively used to construct servers. This is not the case; Node. js can be used on the frontend as well as the backend.


1 Answers

There aren't enough differences between Node.js and Rails for it to practically matter.

A lot of what Node.js can do can be pulled off in Rails with things like EventMachine and Pusher. So unless you are really familiar with Rails' limitations, and know you'll be pushing the boundaries, you'd be hard pressed to make something a seasoned Rails developer couldn't do.

Having built apps in Node and Express I can say that they alone aren't enough to make a sexy application. They can seem just as old and stale if you don't have an outstanding frontend UI to facilitate the backend possibilities. Instead of comparing backend servers, I think the real future of doing amazing things is in front-end JavaScript frameworks like Backbone.js that use Express/Rails/Node.js on the backend.

I have chosen to go in the direction of Backbone.js with Rails as my backend API server. Because it's so easy to rapidly create a very nice RESTful backend server in Rails. Rails also makes working with CoffeeScript and precompiling/organizing Backbone code a breeze. There are already decent Backbone.js gems out there for Rails.

The Rails core is also able to acknowledge and embrace the fact that frontend JS MVCs are logically a good next step, and they have been working to strengthen the bond between the two. For those same reasons they have also worked to make Rails an even better API server so that it can work with frontend JS easier. Node.js and Express aren't putting as much effort to coordinate with frontend JavaScript MVCs as the Rails community is.

Being good with a JavaScript frontend MVC and Rails as a backend makes you also great for both worlds in terms of getting a job. You will easily be able to hop onto a Node.js project and add value to that team with your superior frontend experience, and you can also roll with the punches on a Ruby on Rails team and add value to them as well.

like image 83
Joseph Ravenwolfe Avatar answered Oct 14 '22 16:10

Joseph Ravenwolfe