What is dojo? What is the result of the macro comparison with jquery?

Source: Internet
Author: User

 

Dojo is an open source DHTML (Dynamic HTML) implemented by JavaScript)
Toolkit.

 

What can dojo do ??

 

1. It makes it easier for developers to add dynamic capabilities to web pages. You can also use dojo in other environments that support JavaScript;

 

2. With the components provided by dojo, developers can improve the availability and interaction of Web applications;

 

3. dojo largely shields the differences between browsers. Therefore, developers do not have to worry about whether Web pages are available in some browsers;

 

4. With the tools provided by dojo, you can also write command-line unit test code for the code.

 

5. the dojo packaging tool helps you optimize JavaScript code and only generate the minimum dojo package set required for application deployment.

 

6 ,...... And so on.

 

 

Dojo architecture (only some packages are included and found online)

 

The first layer is the widget System of dojo. widgets refer to an element in the user interface, such as buttons, progress bars, and trees. Widgets allow you to operate buttons and menus, including style and event processing. You only need to add simple labels to the page.

 

The second layer is the application support library, where most of the code of dojo is placed. Most of the time we call the APIs in this layer.

 

The third layer is environment-related packages, which are used to handle cross-browser problems.

 

The fourth layer is the language library, which contains some language tool APIs, similar to Java's util package.

 

The bottom layer is the package system. The structure of the dojo API is similar to that of Java. It divides all APIs into different packages. When you want to use an API, you only need to import the package of this API.

 

Only part of the hundreds of packages provided by dojo. These packages are placed in three level-1 namespaces: dojo, dijit, and dojox. Among them, dojo is the core function package, while dijit stores all the widgets of dojo, while dojox is some extended or experimental functions, the trial functions in dojox may be moved to the dojo or dijit namespace in subsequent versions after maturity.

 

Macro comparison between jquery and dojo:

 

The first statement is not absolute.

 

1. Framework Scale

Dojo is a heavyweight development framework consisting of the framework core (Dojo), basic control library (dijit), and extended package (dojox). The three parts are officially provided by dojo;

 

Jquery is a lightweight framework that only contains the core of the Framework. In addition, it has an independent open-source project, jquery UI, which provides the eight most commonly used controls.

 

It is not absolute. If you use dojo like jquery, dojo is a lightweight JS library.

If you use jqueryui + jquery, jquery is the heavyweight JS library.

 

2. Programming

Dojo uses object-oriented programming to ensure large-scale application development;

Jquery uses function-based programming to make development of small applications more flexible and quick.

 

Dojo enhances and standardizes object-oriented capabilities on the basis of JavaScript, and provides Object-Oriented Programming capabilities not available in native JavaScript, such as the overload of parent methods (note, not rewrite) multi-inheritance, constructor call chain, etc. It also provides a series of object-oriented programming standard functions and attributes such as declare, inherit, declaredclass, extend and so on as the basis of Dojo's own programming. In dojo, all UI controls are defined as classes, and many core function libraries of dojo are also defined as classes, all for better code reusability.

 

Javascript is essentially a functional programming language. jquery does not change the programming method of JavaScript, which greatly reduces the learning cost. It does not mean that jquery cannot perform object-oriented programming at all, but it is not as intuitive as Dojo. It can be inherited like jquery, and it can be written like this. Each home has its own location.

 

3. Code style

In addition to jquery's iconic "$" symbol, dojo and jquery have similar names and parameter lists in some common APIs.

 

4. Learning costs

From the analysis above, JavaScript is essentially a functional programming language. jquery does not change the programming method of JavaScript, which greatly reduces the learning cost. It is easy to get started with the basics of JavaScript programming. However, if you want to create an interface with a higher user experience, it is impossible to rely solely on technology. Since dojo and jquery have similar code styles, it is not very difficult to learn dojo because they have jquery basics. On the contrary, it is not difficult to learn jquery again because of the dojo Foundation.

 

5. Applicability

 

Dojo has outstanding features in Object-Oriented support, code architecture, multi-pole module loading mechanism, and control integrity, and is suitable for enterprise-level or complex large-scale Web application development;

 

Jquery's architecture and mechanism are relatively simple, easy to develop, and widely used. It is suitable for relatively simple Web 2.0 development.

 

Dojo and jquery are designed for complex application development and simple application development respectively, but they are not absolute. It depends on how developers use them. For applications with too many UI interactions, choose dojo.
But it is also a good way to choose jquery + jquery UI.

 

In actual projects, you need to select Tools Based on specific needs.

Well, it seems that all the comparisons are better to be specific analysis of specific problems. This article is also true. I don't want to mislead anyone.

 

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.