Angular.js Backbone.js and other MV* patterned js libraries? [closed]

CommunityRazort4x提出了一个问题:Angular.js Backbone.js and other MV* patterned js libraries? [closed],或许与您遇到的问题类似。

回答者CommunityMartin S.给出了该问题的处理方式:

There is probably no objective answer, but here's my 2 cents:

Backbone usually leads to much larger code bases that are more difficult to maintain. Similar to the anecdote in your links, I've worked on one project where the code shrank from 2500 lines with Backbone to 600 lines with Angular. Knockout probably would have yielded equally small (=good) results. My colleagues have moved away from Backbone to Knockout and were much happier afterwards.

The advantage of Backbone is that it is really lightweight and gives you more options to structure things. That also means you can do more performance tuning, so it can be faster. Those very same aspects are also its disadvantage: You need to structure things yourself which means: more code, more complicated and potentially more bugs.

Regarding the tests you mention: They are hardly objective, since they emphasize one very particular use case. Also, they were posted by the author of Backbone himself, so obviously they show Backbone in a good light. For normal UIs, performance should not be a problem no matter which of the 3 (Backbone, Angular, Knockout) you choose. One caveat for Angular: If you want to dynamically display more than 2000 elements on your page, it could be problematic (see the answer of Angular's creator himself here: How does data binding work in AngularJS?).

About Dart: Its goal is to be a language, not just a MV* framework within a language. That is a completely different beast and if you simply need a MV* framework, Dart would be overkill. Also, Dart is still very young and not natively supported in most browsers.

希望本文对你有帮助,欢迎支持JavaScript中文网


公众号

欢迎 JavaScript 爱好者