Backbone.js

Javascript Frameworks

I've noticed that many Rails developers are supplanting their Rails knowledge with some Javascript knowledge in order to best accomodate the full-stack. With all the Javascript frameworks out there, it's hard to figure out which to start off with. As I have some experience with semantic Javascript already, I decided to go with Backbone.js

MV

Unlike the other heavy MV* JS frameworks like Angular and Ember and it's lighter brother React.js, Backbone is only the model-view. It's somewhat of the in-between in terms of Javascript frameworks.

Rails + Backbone.

I've decided on creating applications that use a Rails backend with a Backbone.js frontend and then eventually migrating over to an entirely JS stack using a variation of the MEAN stack, but without the Angular. That way I can quickly pick up the other frameworks as necessary. I'll try to keep a log of my journey.

Backbone Workflow

  1. Instantiate Backbone router to listen for URL hashchange events.
  2. On specific hashchange, Router will fetch model/collection data from server.
  3. After fetching model/collection data, Router instantiates a parent collection view and render into the DOM.
  4. Parent collection view also should have a reset function so that when server lists new data, the collection view will automatically iterate through each model data and output the subset model view within the collection view.