Chapter One: JavaScript Framework Classification and main functions

Source: Internet
Author: User
Tags mootools

From the internal architecture and concepts, the JavaScript framework can now be divided into 5 classes.

The first is a namespace-oriented class library or framework, and if an array is created with the new Array (), an object is generated with the new object (), the full Java style, so we are constantly adding objects and two-level object properties to organize the code as an object. , such as the pyramid, the early representatives of Yui,ext (so, not dynamic companies are also using them)

The second type is a factory-oriented framework. Famous prototype, and MooTools, Base2, Ten, they basically except the most basic namespace, the other modules are a class factory derived from the class object. In particular, mootools1.3 encapsulates all types into type types.

The third is a selector-oriented framework that is represented by jquery, and the entire frame or library body is a special class array object that facilitates the set operation (because the selector selects the N element node at a single point), and it is processed together. There are several great things about jquery:

    • The "No new instantiation" technique, $ (expr) is to return an instance without the need for explicit new out;
    • Get first set all access rules;
    • Data caching system. This allows the node event to be assigned.
    • Iife was also discovered.

The fourth is the frame in which the loader is concatenated, which has multiple JavaScript files, each of which is written with a fixed rule. One of the most famous is AMD. Modularity is the symbol of JavaScript's trend toward industrialization, "the only way to write complex software is to have a clear interface, to combine several modules, so that most problems only occur locally, then there is the hope of improving and optimizing the parts, Without affecting the whole body. "Many internal frameworks are basically adopting this architecture, such as Dojo,yui,kissy,qwrap,mass, (REQUIREJS,SEAJS) and so on.

The fifth is the mv* with a clear layered architecture, first JavaScript MVC, (now called Canjs), Backbone.js and Spinejs, and then more in line with the actual MVVM framework of the front end, such as, knockout, Emberm,angular,avalon,winjs. In the MVVM framework, the original DOM operation is replaced by declarative binding, which is handled freely by the framework and the user focuses only on the business code.

The main features of the JavaScript framework

jquery Framework Class Library Module division is mainly based on GitHub source code, is basically a module of a JavaScript file, jquery began to focus on the DOM operation of the idea is right at the beginning, and constantly on the compatibility, performance improvements, After years of development, jquery's huge plug-ins and perfect bug submission channels, making itself constantly improved

Prototype.js The early Kings, it was divided into four parts.

    • Language extensions
    • Dom Extension
    • Ajax section
    • Obsolete parts, new versions to achieve the original function with other methods

Prototype.js has a wide range of language extensions, including basic data types and "classes" borrowed from the language. Among them, enumerable is only a common method package, Objectrange, Periodicalexecuter, Templat is produced by the class factory (from the Community contribution).

MooTools because the API design is very elegant, its official website has many high-quality plug-ins, not in the prototype expansion of the anti-tide decline.

Rightjs: Another framework in the prototype expansion,MochiKit a Python-style framework, very original, can enter the framework of the first ten.
Ten: Japan's famous blog Community Hatena JavaScript Framework, Amachang development, affected by Prototype.js, is the first space-named framework model;Mass Framework : A jquery-style framework that targets the development of large modules.

After a detailed comparison, it is easy to draw the conclusion of the following framework features

      • The basic data operation is the basis, such as jquery provided by the trim CamelCase each map method, prototype.js and other intrusion-type framework in the prototype add camelize and other methods
      • The type of decision is not rare, the common form is the JSXXX series
      • Selector, Domready Ajax is standard for modern frames
      • Dom manipulation is a priority, the traversal of a node, the operation of a style, and the operation of a property belongs to its category.
      • Event proxies are now supported by the mainstream event system
      • Data caching and processing, the browser also supports the Data-property to operate, but does not work well, need framework encapsulation
      • Animation engine
      • Easy development and extensibility of plugins
      • Provides solutions such as deferred to handle asynchrony
      • Even if a class factory is not specifically provided, there should be a method named extend or mixin to extend the object. Although jquery does not have a class factory, it also has to add one to the jquery UI, which can be seen as important.
      • Since jquery came out with a method called Noconflict, the emerging framework has taken this approach in order to survive in the slit.
      • Many frameworks attach great importance to cookie manipulation.

Chapter One: JavaScript Framework Classification and main functions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.