Framework Classification and main functions of JavaScript frame design

Source: Internet
Author: User
Tags mootools

This article mainly introduces the JavaScript frame Design Framework Classification and the main functions of the relevant data, the need for friends can refer to the

The current JavaScript framework can be divided into 5 categories, from internal architectures and concepts.

The first is a namespace-oriented class library or framework, if you create an array with the new array (), generate an object with the new objects (), the full Java style, so we keep the object and the level two object attributes for it to organize the code, like a pyramid base. , the early representatives of Yui,ext (so, not the dynamic companies are still using them)

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

The third is a selector-oriented framework represented by jquery, the whole frame or library body is a special class array object, convenient to set operation (because the selector all of a sudden select the N element node), and then processed together. jquery has a couple of great things:

The "No new instantiation" technique, $ (expr), is to return an instance without requiring an explicit new one;

Get-all access rule;

Data caching system. This allows you to assign a node event.

Iife was also discovered.

The fourth type, the frame in which the loader is concatenated, has multiple JavaScript files, each of which is written in a fixed rule. Among them, the most famous is AMD. Modularity is a sign that JavaScript is moving toward industrialization, "the only way to write complex software is to have a clear interface and a combination of several modules, so that most problems only occur locally, and there is a desire to improve and optimize the local area without affecting the whole body. "Many enterprise internal frameworks are basically taking this framework, 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 front-end MVVM framework, 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 only concentrates on the business code.

The main features of the JavaScript framework

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

The early kings of Prototype.js, which were divided into four parts.

Language extensions

Dom Extension

Ajax part

Obsolete part, new version implements original function in other ways

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 class factory (from Community contribution).

MooTools because of the elegant API design, its official website has a lot of high-quality plug-ins, not in the prototype expansion of the opposition to the decline in the wave.

Rightjs: Another framework on the prototype extension, mochikit a Python-style framework, very original, can go into the top ten frame.

Ten: Japan's famous blog Community Hatena JavaScript Framework, Amachang development, affected by the Prototype.js, is the first space-named framework model; Mass framework: A jquery-style framework that aims to develop large modules.

After a detailed comparison, we can easily draw the conclusion that the following framework features

?

1 2 3 4 5 6 7 8 9 10 11-12 Basic data operations are the basis, such as jquery provided by the trim CamelCase each map and other methods, prototype.js and other invasive frameworks on the prototype to add camelize, such as the determination of the type of method, the common form is Jsxxx series selector, Domready Ajax is a modern framework standard DOM operation is the most important, node traversal, style operation, attribute operation also belongs to its category now the mainstream event System support event proxy data caching and processing, the current browser also supports data-properties to operate, but not easy to use, need frame encapsulation Easy development and extensibility of animation engine Plug-ins provide solutions such as deferred to handle asynchrony even if a class factory is not specifically provided, there should also be a method named extend or mixin that extends the object. jquery does not have a class factory, but it also has to add one in the jquery UI, which can be seen as important. Since jquery came out with a method called Noconflict, the emerging framework takes this approach in order to survive in a slit. Many frameworks attach great importance to cookie operations.

The above mentioned is the entire content of this article, I hope you can enjoy.

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.