javascript 决定:用于 Rails 3.1 应用程序的 dojo、backbone.js、knockout.js(或其他)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9181304/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Deciding between: dojo, backbone.js, knockout.js (or other) for Rails 3.1 app
提问by Tom Harrison
We have an existing Rails 3.1 consumer-facing web app and are reworking the UI to be far more interactive, snappy, app-like.
我们有一个现有的 Rails 3.1 面向消费者的 Web 应用程序,并且正在重新设计 UI,使其更具交互性、更活泼、更像应用程序。
We have a modestly complex data model, but there's only a modest need for form-based user input.
我们有一个适度复杂的数据模型,但对基于表单的用户输入只有适度的需求。
We use jQuery now, with plugins to do nice effects, but overall, our JS skills are weak.
我们现在用jQuery,用插件做效果不错,但总体来说,我们的JS技术比较薄弱。
Our primary objective is to find a framework that helps us structure and organize our JS code and simplify the cases where we do have data bindings, AJAX, etc. in our Rails 3.1 world.
我们的主要目标是找到一个框架来帮助我们构建和组织我们的 JS 代码,并简化我们在 Rails 3.1 世界中确实有数据绑定、AJAX 等的情况。
We'll learn how to do JS properly, but while we do, is there a clear framework we could learn and work within?
我们将学习如何正确地使用 JS,但是当我们这样做时,是否有一个我们可以学习和工作的清晰框架?
回答by Tomasz Zieliński
I don't know Dojo, but Backbone vs Knockout is a bit like comparing apples to oranges.
我不知道 Dojo,但 Backbone vs Knockout 有点像比较苹果和橙子。
Backbone provides a structure for a web application + synchronization with the backend, whereas Knockout drives UI updates. There issome overlap between the two, but it doesn't mean they are actual competitors. There is even a project that tries to combine both - Knockback.
Backbone 为 Web 应用程序 + 与后端的同步提供结构,而 Knockout 驱动 UI 更新。还有就是两者之间有一些重叠,但并不意味着他们的实际竞争者。甚至有一个项目试图将两者结合起来 - Knockback。
Last but not least, there is a great discussion on Bb vs Ko.
最后但并非最不重要的是,有一个关于Bb 与 Ko的很好的讨论。
EDIT:I've just found this: http://addyosmani.github.com/todomvc/- a comparison of different approaches to creating the same TODO app.
编辑:我刚刚发现了这个:http: //addyosmani.github.com/todomvc/- 创建相同 TODO 应用程序的不同方法的比较。