Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Great tutorial but when I see this in the conclusion:

Backbone.js really introduces a new kind of data flow for Rails apps. Instead of data flowing like this:

Rails Model => Rails Controller => Rails View

It now flows like this:

Rails Model => Rails Controller => Backbone Model => Backbone Controller => Backbone View

I get confused. 5 components instead of 3—sweet. Why do I want backbone as part of my rails app? Just to ajax-ify everything? Will it reduce the load on my server?



You want Backbone as part of your Rails app to clean up your Javascript and make it easier to do hard things…it’s meant for apps that let the user do significant client-side state manipulation.

The alternative to “5 components instead of 3” isn’t “just 3”. It’s “3 well-understood components on the server, and a bunch of jQuery/prototype spaghetti on the client that I really wish was better-organized and easier to extend.” If this describes your app, you might do well to look at Backbone.


In most cases, it will dramatically increase the load on your server, especially if you use a ReST API like the author suggests.

UPDATE: To clarify, in the specific situation the author describes (exactly one model class, no relationships, basically the simplest "schema" one could create), the load will go down slightly. For real, interactive single-page apps (the kind backbone.js is targeting), the load will go up because apps requests data often, way faster than your current app which is limited by page refresh time.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: