Introduction to 10 design flaws in JavaScript

Source: Internet
Author: User

A few previous articles, I often said that JavaScript design is not rigorous, there are many mistakes.

Today, the first half of this article talks about why this is the case, and the second half enumerates 10 design flaws in JavaScript.

My reference is mainly in Douglas Crockford's monograph "The JavaScript Language pristine" (javascript:the good Parts) and Fredrik Holmstrm's article "My Complaints about JavaScript" (my Gripes with Javascript).

Why is there a design flaw in JavaScript?

There are three objective reasons why JavaScript design is not perfect.

1. The design phase is too hasty

The design of JavaScript in fact only took 10 days. Moreover, the designer is in order to the company, I do not want to design (see "The Birth of JavaScript").

On the other hand, this language is designed to solve some simple web interaction (for example, check "username" to fill in), and does not consider the needs of complex applications. The designer never dreamed that JavaScript could write a huge and complex web page like Gmail in the future.

2. There is no precedent

JavaScript combines functional programming with object-oriented programming, which is probably the first case in history. And until today, JavaScript is still the only major language in the world to use the prototype inheritance model. This makes it less of a design precedent to refer to.

3. Premature standardization

JavaScript is developing very fast and there is no time to adjust the design.

May 1995, the design was finalized, October, the interpreter successfully developed, December, launched to the market, is immediately widely accepted, the world's users a large number of use. JavaScript lacks a small to large, slowly accumulate the user's process, but the continuous explosion of proliferation growth. The extensive participation of both web and amateur web designers makes it difficult to adjust language specifications.

To make it worse, the JavaScript specification has not yet been adjusted and is cured.

In August 1996, Microsoft had a strong intervention to announce its own scripting language jscript;11 months, in order to suppress Microsoft, Netscape decided to apply for JavaScript international standards, June 1997, the first international standard ECMA-262 officially promulgated.

In other words, after the introduction of JavaScript 1.5, international standards came out. Design flaws have not been fully exposed and become standard. By contrast, almost 20 years after the advent of the C language, international standards were promulgated.

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.