4 ms·
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 fallaci
by jdunck 16y ago
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_Computing 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.
- jashkenas 16y agoThis 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...