by jashkenas · 14y ago · 0 comments
It would be great to have a more step-by-step in-depth tutorial available on Backbonejs.org, and if I don't get a chance to built one out soon, I'd be glad to merge a branch that adds one.
Tutorials aside, is there something more in the way of API documentation you'd like to see, that you aren't finding on Backbonejs.org?
Finally, there is a long list of real-world apps available, many of which have viewable source code that you can examine and learn from:
http://backbonejs.org/#examples
... and DocumentCloud.org, the original application from which Backbone was extracted, has all of its JavaScript available on GitHub:
https://github.com/documentcloud/documentcloud/tree/master/p...
edit/note: its been about 6-8 months since I was looking at backbone hard, so this may have improved.
But I wish the Backbone docs would talk about how to structure larger applications. Yes, I agree with the philosophy of "There's More Than One Way To Do It" but I don't think that's a good reason for the fact that there is no recommended best practice for how to modularize and organize code for a Backbone app that's larger than the trivial to-do example. Some discussion of architecture for larger apps, along with some example code, would be great.
At present it's an annoying contrast to see the small to-do example and the screenshots of elaborate examples that have many models, collections, routes, etc. Would be great if the docs could do a better job bridging the two.
http://documentcloud.github.com/backbone/#Model-fetch
explains in a paragraph that it updates the object and fires a 'change' event. Right below in
http://documentcloud.github.com/backbone/#Model-save
the text explains how the backbone.sync handles the save function. What's sets me back is that the backbone.sync strings "change" and "update" are both quoted and highlighted just like an "event". It is not apparent from the method call if an event is ever fired. Upon careful inspection you notice it also calls set if the values are passed or values are returned differently. The set method triggers a change event.
Eventually these things become second nature and you just know them. The tricky part is finding a good place to start from. Maybe a list of good practices, maybe a good up to date tutorial showing a simple app that uses models, collections, views, routes, and a real backbone.sync.
We should fix the Model#save paragraph to make it clearer that the strings are the potential values of the "method" parameter.
Thanks for all the great work! I use and love BB, CS and _ everyday.