First Backbone no AngularJS so easy to get started. And the author does not want to let the backbone grass-roots meaning.
Backbone is likened to a fighter. It looks more like the real MVC Framework, Model-views-controller (collection).
When writing backbone, the model, the collection of data, the views are separated, the logic is clear. The benefits of JS templates are naturally not much to say. Backbone is actually ((in order to remove the previous jQuery over-Reliance DOM to write business logic, resulting in late code logic confusion, Dom and JS tightening coupling.) The function internal layer calls, and even a variety of Kua multiple file layer calls. Making business ultimately difficult to maintain, More and more bloated, the higher the functional coupling. The easier it is to modify, the more likely it is to cause unpredictable bugs in other features. ), while backbone largely unlocks the coupling between DOM and JavaScript. Closer to the true meaning of MVC. but backbone only provides the basic tools. No more complex encapsulation is carried out.
Advantages of Backbone :
- Small size, very strong formulation.
- Provide underscore tool functions to process data according to each programmer's different style, or you can encapsulate it yourself
- Provide a custom template engine, that is, how you want to render, how to render
- Provides a complete restful style API. How to write if you want to.
- Model, collection, view separation. Clear logic. A programmer who knows a little bit of code can write a good logical structure.
AngularJS is likened to a tank.It looks more like a cover-up for HTML-building Applications (as the official itself describes it). Combine JS logic and HTML tags tightly together, through dependency injection, to achieve the development of modularity. Angularjs does provide a lot of traversal, encapsulating a lot of complex logic, two-way data binding. Logical Region Division. So it's a heavy weapon.
-------------------------------------Insert is written here-------------------------------------------
Pass: about why Google pushes AngularJS, not the originator of MVC backbone
First, compatibility is convenient,BackboneAdhere to support IE6 above the browser, the principle is that most browsers can run backbone. Angular is diametrically opposed in this respect. Angular because the library itself is very large, many modules, in order not to let the library become bloated, inAngularJSAfter 1.3 does not support IE9 below the browser (IE9 also has a lot of problems). In other words, AngularJS development is for some high-end apps. High-end applications, in other words, some people who know a little computer know how to upgrade the browser, and Google has the best experience.
So Google first push angular, you can not see the site, was prompted version is too low, either do not look later, or you will choose to upgrade the browser, or to change the browser, I think most will be upgraded browser.
AngularJS is very unfriendly to some search engines with low technical content, for no reason. Google's search technology has rocked the world, and crawlers can identify the data after JS rendering. That's one of the reasons why Google is pushing angular.
-------------------------------------The end of the small paragraph-------------------------------------------
Advantages of AngularJS:
- Easy to get started, must understand dependency injection
- Two-way data binding can be done with a small amount of code. Automatically synchronizes data changes. Backbone need to manually
- and HTML are combined to write logic. The HTML structure is clearly divided.
- Dirty value detection.
- Do not rely on other third-party libraries
The main advantage of the 1.Backbone and AngularJS ratio is the fact that the mobile side,and its compatibility.,Backbone Combination compatible IE6-IE11 post-modern browsers are fine. AngularJS is compatible to IE8., there are many features that are problematic on IE8. and angularjs the action by adding custom attributes to the labels and mixing them with the template. So it's very unfriendly for search engines,Whether you are using a template in a way such as {{item.data}} or a custom attribute Ng-model = "Item.data" to give you a label binding model. Search engines are unable to read the actual rendered data inside your tag. and read a template such as {{Item.data}}. (most crawlers ignore the effect of page JS.) . Very bad for SEO.
2.Backbone and AngularJS in terms of volume, there is no advantage to say,(Does not count the site opened gzip) on a surfaceThe compressed angularjs is probably 101k-120k.(The developer version without compression is 800K or more, 1.2.X version). No need to rely on any other JS library.
And Backbone relies on underscore.js compression after Backbone + underscore = 20k + 14k = 34k ~ 36k appearance. Don't be happy too early, Backbone also needs to introduce a core library. Similar to jquery. PC development, introduced a compressed jQuery1.11.1 is 101k~105k, incompatible IE6 7 8 introduced compressed JQuery 2.0 or later is 89K ~ 94k. So the size adds upBackbone + underscore + jQuery = 130k ~ 145k.
If the development of the mobile side, do not need to introduce jquery, but use zepto words. The size of the backbone combination plunged to 44k~50k. This time backbone on the mobile side of the advantages of the show.
and so. Backbone + underscore + jQuery (or Zepto) is 2 more HTTP requests than a single angularjs.
3. Note Here, backbone own description is not necessary! Rely on jquery and zepto. In fact, it doesn't have jquery. Its view view will make a variety of mistakes, so plainly, he himself tied to jquery. For other DOM libraries you have to work on your own, and the old version of backbone doesn't offer you the right to change the library at all.
Backbone The surface says it doesn't depend on jquery. actually .... Oh, you know, there's no jquery. How does the view bind to the DOM? El does not support fetching DOM nodes like document.getelementbyxxxx. So I want to say, if you don't want to get too many libraries in the project, find Angularjs. Backbone in, you have to use a jquery!.
If anyone with ruby experience knows that backbone is actually putting Ruby on rails to the front end, Ruby programmers will understand the structure of backbone.
1.BackboneVery few instances. The tip of the iceberg.
2.Backboneis a framework, not a library.
3.BackboneOnly tool functions small, simple, flexible are provided. Which is not exactly the same as jquery, not"Write less, does more"
4.BackboneDoes not reduce the amount of code written, with a bad instead of adding a lot of work, a seemingly simple function, with backbone reality looks like always feel very awkward. So a bad person would be"Write more." do Less "
5.Backbone can not play its ultimate completely depends on the user's level, so the author's understanding of the framework is: "A framework calls you, your call a library"
for a novice, not having a certain native JavaScript skills is difficult to master backbone, only limited to a few $ symbols to be completely unable to understand the philosophy of backbone.
BackboneSo far there is no complete Chinese document, before a person translated the 0.5 version of the Chinese document (basically can say he did not translate ...), but the current backbone is more than 1.0 version. A number of features have been added before. Can say, want to learn the person, even if you read English, understand the API, no instances, you do not know how to apply. There are very few books on the market.
And can put backbone play to the extreme, is generally foreigners, for example, the famous USAToday used backbone. It's hard to imagine a big news site in the United States is a backbone builtSpa (Note: The use of spas in foreign countries has been very common, not uncommon, anti-domestic web technology can be said to fall behind others 5-6 years)
USA today:latest World and US News
18,258 star from backbone on GitHub is enough to prove its status abroad. (Note:Jeremy Ashkenas on GitHub in 08. Very deep native JavaScript background.)
Counter-ViewAngularJS,Many Chinese documents, there are many examples on the Internet, it is easier to get started than backbone.and Angularjs No need to force dependencies on other libraries. And backbone itself relies on the author Jeremy Ashkenas himself developed another JS toolkit underscore can say you want to learn backbone, will have to learn and learn underscore. In underscore, there are more than 60 methods for arrays, collections, and function operations. Only by practicing in the project can we really understand the purpose of underscore. This also caused a steep Backbone learning curve, especially for those of you who are not familiar with MVC, Model, Collection can be said to be obscure and difficult to understand.
Backbone vs AngularJS