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

Key point of Backbone.js: This is for designing web apps, not just a web page. When you have multiples of the anything on a page, it's time to move to separating out your views from your models, and Backbone.js is perfect for this sort of transformation. Even better if you start with Backbone.js. And Backbone.js is a minimal set of functionality to get this done.

We use Backbone.js at DocumentCloud for our document workspace. It took a few weeks to pull out all the pieces, but we rely on the JavaScript MVC that Backbone gives us for the entire workspace. (That too will go open-source, someday soon enough.)

I am personally planning on integrating Backbone into NewsBlur, an RSS feed reader, which currently has an ad-hoc model system. Backbone would give it the ability to update stories and feeds without having to remember where all of the stories and feeds are on the page.

Anyway, Backbone takes a bit of getting used to, but it is fairly easy to read the annotated source to see exactly what's happening. And once you do learn the Backbone.js conventions, hard problems become much easier on the front-end.



I'm concerned that the default approach to saving is making a request to the server. Defaults matter, and this default will lead people to ignore the 8 fallacies: http://en.wikipedia.org/wiki/Fallacies_of_Distributed_Comput...

N+1 across the internet will suck.

I assume it's early days, but please consider this issue. It's killed a bunch of otherwise interesting libraries.


This issue is very much considered. You absolutely don't use this to make a bunch of tiny little Ajax requests to load your application in pieces. Instead, you bootstrap all of the data you need for an initial load onto the page, and then populate the collections directly.

For saving, a single update often needs to be a single request, and the UI needs to know that the update has been applied successfully. If you need to do a bulk update, then use "set", not "save", and make a custom Ajax call for the bulk operation.

Finally, Backbone.sync is the lowest-common-denominator default REST request, which will work for many applications. You can and should override it if you have more specific needs -- using timeouts to aggregate many granular saves into a single HTTP request is a great idea for some applications...




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

Search: