

Ask HN: Angular, Ember, Node- Where should a noob Rails dev begin? - piratebroadcast

I&#x27;m finishing learning Rails and next wish to get some JS under my belt- I wish someone would please explain the difference between Javascript, Angular, Ember, Node, and where a noob Rails dev with no JS knowledge whatsoever should begin in all of this.
======
stevekinney
Congratulations on learning Ruby on Rails. JavaScript is a lot of fun and
super powerful these days. I'm going to try to unpack your question to the
best of my ability.

As you probably already know—JavaScript is a language and the rest are all
libraries and frameworks built in JavaScript (Node also has a C++ core too,
but I digress). Just like Ruby is the language that Rails is built in.

The first distinction is between client-side and server-side technologies.
Client-side code (e.g. Angular, Ember, Backbone, jQuery) run the in browser on
the user's computer. Angular, Ember, and Backbone try—to an extent—to apply
the MVC approach (like in Rails) to your JavaScript on the client in an effort
to keep your code organized and DRY.

You only need one of the three. Backbone is probably the most popular.
Angular, which is built by Google, also has a strong following. Ember is up
and coming, but it's built by Yehuda Katz amongst others. Yehuda is a core
contributor to Rails and Ember shares many of the same values (e.g. convention
over configuration). In addition, it's built to play nicely with Rails.
Backbone is the most minimal of the three and Angular takes an approach that
expands HTML in interesting ways. It's worth dabbling in all three and seeing
which one tickles your fancy. I should note that you can use any of the three
with Rails. That might be a good jumping off point as you explore the world of
JavaScript.

Okay, now on to the server. Node.js is a completely different beast than
Rails. It's a platform, not a framework. This a bad example, but it's probably
closer to Apache, Nginx, Webrick, or Mongrel than it is to Rails or Django. It
basically creates a server-side JavaScript environment based on Google's V8
JavaScript engine along with some basic modules for networking and filesystem
IO.

A big difference is the community. The Node community tends to favor small,
modular code that can be pieced together to create bigger systems. As a
result, large monolithic frameworks like Rails haven't really gain any kind of
traction in the Node community. The frameworks exist, sure—Sails and Tower are
two such examples, but they haven't really taken off.

The best place to start is probably Express.js, a popular but lightweight
framework for Node inspired by Ruby's Sinatra. If you're not familiar with
Sinatra in Ruby, play with that first (along with Ember, Backbone, or Angular)
and then try Express. Express is actually a little more robust than Sinatra
(for example, it includes a solution for logging—Sinatra does not).

It's also worth getting comfortable with NPM (the Node Package Manager). It's
a lot like RubyGems, but with some interesting differences—for one, it keeps
your modules (gems to the Rubyist) in a directory local to the project. I like
to think that NPM is what RubyGems would be if RubyGems got to start over
knowing it's own mistakes.

I hope this helps. Feel free to reach out to me on Twitter (same username) if
you have any further questions.

~~~
ulisesrmzroche
Awesome write-up. Have you jumped ship from Ruby to Javascript completely? I
did so recently, and would love more tips if you have them, but for an
experienced Rails developer instead of for novices.

------
hardwaresofton
Also, if you're starting with rails web design, maybe it's a good idea to
start with just vanilla rails?? All the tools you mentioned are pretty indepth
and you generally can't just "walk on" to using them well.

I might suggest going through the learning curve this way:

\- Rails + regular JS

\- Rails + jquery/underscore (I'd moreso recommend jquery because everyone
knows it)

-Rails + jquery + knockoutJS (it's pretty small, and does one thing, after using jquery, you should start to notice the problem it solves)

\- Rails + angular (angular is complex, but by the time you string together
pages with jquery and knockout, you'll start to see why you need a system like
angular to really step in and handle things)

I just think it's important to experience/understand a problem before using
the tools that solve it.

------
pjungwir
If you're just getting started with Javascript, I'd say learn Javascript and
jQuery. Here are two good books:

    
    
        http://www.amazon.com/dp/0596517742
        http://www.amazon.com/jQuery-Action-Second-Bear-Bibeault/dp/1935182323
    

If you want to use Javascript/Ajax in a Rails application, this is a good
introduction to how Rails' "remote" forms/links work in a jQuery context:

    
    
        http://www.alfajango.com/blog/rails-3-remote-links-and-forms/
        http://www.alfajango.com/blog/rails-3-remote-links-and-forms-data-type-with-jquery/
    

I would get to the point where you understand all that before tackling
Angular, Ember, or Node.

------
codemonkeymike
Start with Yeoman with the Angular.js generator. Extremely robust and fun to
use.

