TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Backbone.js Tips : Lessons from the trenches

95 pointsby prateekdayalalmost 14 years ago

6 comments

jashkenasalmost 14 years ago
This is a very useful post -- unfortunately, it describes an all too common occurrence: treating a single example as gospel truth. I've gone ahead and added an explicit "There's More Than One Way To Do It" section to the FAQ.<p><a href="http://documentcloud.github.com/backbone/#FAQ-tim-toady" rel="nofollow">http://documentcloud.github.com/backbone/#FAQ-tim-toady</a><p><i>Edit</i>: Also, for folks looking for useful patterns, I'd recommend scrolling through and viewing source on a few of the increasingly lengthy list of example apps:<p><a href="http://documentcloud.github.com/backbone/#examples" rel="nofollow">http://documentcloud.github.com/backbone/#examples</a><p>Pandora, Trajectory, and SeatGeek were added recently, and there are more that are waiting for a blurb, including Sky+ and GroupOn:<p><a href="http://skyplustv.sky.com/tv-guide" rel="nofollow">http://skyplustv.sky.com/tv-guide</a><p><a href="http://www.groupon.com/now" rel="nofollow">http://www.groupon.com/now</a>
评论 #2821939 未加载
评论 #2822060 未加载
vmindalmost 14 years ago
'Collections should keep track of their views' seems badly explained. You're not keeping references to views on a collection, you're keeping a reference to subviews inside a view that uses a collection. The code is correct, and agnostic to whether the collection is local to the view, or a shared collection.
评论 #2821271 未加载
dmvaldmanalmost 14 years ago
Just like to add that Jashkenas has updated the Todo example code that this article refers to (3 hrs ago at the time of this comment).<p>The link in this article in the first section "Models should not know about Views" should link instead to <a href="http://bit.ly/pfnFYu" rel="nofollow">http://bit.ly/pfnFYu</a><p>(gotten from the github history)
Swizecalmost 14 years ago
To summarize: MVC, MVC, and more MVC.<p>Keep things decoupled with abundant usage of events.
评论 #2821082 未加载
评论 #2822966 未加载
评论 #2820990 未加载
hippichalmost 14 years ago
most of these is applicable to any MVC framework.
rushabhalmost 14 years ago
After studying backbone and other such Javascript MVC frameworks, I realized that they are not necessary.<p>JS has a wonderful MVC architecture built-in. all JS objects are models by defaults, all views (HTML elements) are models too, and JQuery has a lot of helper functions to simplify events.<p>These frameworks give you a good idea of how to organize your code better and help you standardize implementation, but if you know what you are doing, you can do it anyways.<p>Edit: typo
评论 #2821553 未加载