Javascript: the most misunderstood language in the world

Source: Internet
Author: User

Original article address:Javascript: The wrrrld's most misunderstood Programming Language  

Translation:Shiningray
Http://www.nirvanastudio.org/

Javascript, Also known as mocha and livescript, also known as JScript ecmascript, is a popular tool in the world.Programming Language. In fact, almost every PC in the world has at least one javascript interpreter installed. The popularity of JavaScript lies in its role as the scripting language of WWW.

No matter how popular it is, few people know that JavaScript is a very dynamic generic object-oriented programming language. How can this be a secret? Why is this language so misunderstood?

About name

ThisJava-The prefix implies the relationship between JavaScript and Java, that is, javascipt is a subset of Java, that is, it is not as powerful as Java. It seems that this name is intentionally confusing, and then comes with misunderstanding. Javascript is not an interpreted Java language. Java is interpreted Java and JavaScript is another language.

The syntax of JavaScript and Java is similar, just like that of Java and C. However, it is not a subset of Java, just as Java is not a subset of C. In terms of applications, Java is much better than originally imagined (formerly known as oak ).

Javascript is not developed by Sun -- the home of Java. Javascript is developed by Netscape. It is originally called livescript. This name is not so confusing.

This-ScriptThe suffix implies that it is not a real programming language-the script language does not seem to be a real programming language. However, this is actually a matter of expertise. Compared with C, JavaScript sacrifices performance but brings more expressive and dynamic power.

Lisp in the C coat

Javascript C-style syntax, including braces and complexForStatement to make it look like a common procedural language. This is misleading because JavaScript and functional languages such as LISP and scheme have more similarities. It replaces the list with arrays, and uses objects instead of attribute lists. The function is of the first type. And there is a closure. You can use Lambda operators without balancing those parentheses.

Mindset

Javascript was originally designed to run in Netscape Navigator. Its success makes it a standard configuration for almost all browsers. This leads to a mindset. Javascript is simplyProgramLanguageGeorge Reeves(An actor once played Superman, but later killed and killed, was officially considered to have committed suicide. Details are unknown ). In fact, JavaScript is also suitable for many web-independent applications.

Changing goals

The first version of JavaScript has very weak functions. It lacks Exception Handling, internal functions, and inheritance. Its current form is already a complete object-oriented language. However, many opinions are based on the assumption that its form is not mature.

ECMA members managing the language are developing extensions with a good intention, but this will aggravate the most serious problem of the language: too many versions. This also causes confusion.

Design Error

There is no perfect programming language, and JavaScript also has design errors, such as heavy loads indicating addition and string connections with type conversion, and error-proneWithStatement should be avoided. The reserved word policy is too strict. The addition of semicolons is a big error, and the mark of the regular expression is also. These errors will lead to programming errors, and the design of the language as a whole is called a problem. Fortunately, these problems can be used very well.AndLintProgram to avoid.

The overall design of this language is still sound. But it is surprising that the ecmascript Committee does not seem to want to correct these errors at all. Maybe they are more interested in making a new one.

Dirty implementation

Early implementations of JavaScript were hundreds of errors. This has a bad impact on the language. Even worse, these implementations are also embedded in a browser with hundreds of errors.

Poor books

Almost all books are terrible. There are errors and poor examples and a set of poor practices. Important features in a language are often hard to explain or simply not written. I have read dozens of JavaScript books. I only recommend two books:Javascript: the definitive guide (4th edition)By David Flanagan andDynamic HTML (2nd edition)By Danny Goodman. All come fromO 'Reilly.

Not standard enough

The official Standard Specification for this language is released by ECMA. This specification is also of odd quality. It is hard to read and understand. It also makes a "contribution" to the problem of poor books, because the authors cannot use this standard document to increase their understanding of the language. The ECMA and tc39 committees should be deeply ashamed of this.

Amateurs

Most people who write JavaScript are not programmers. They lack the skills to train and write programs. Javascript has such rich expression capabilities that they can use to writeCode, In any form. This has brought a reputation for JavaScript-it is specially designed for layers and is not suitable for professional programmers. This is clearly not a fact.

Object-oriented

Is JavaScript object-oriented? It has objects and can contain data and data processing methods. Objects can contain other objects. It does not have a class, but it has a constructor that can do what the class can do, including the role of the container that plays class variables and methods. It does not have class-based inheritance, but it has prototype-based inheritance.

The two methods for establishing an object system are inherited (......) And aggregate (there is ......). Javascript has both, but its dynamic nature allows it to surpass aggregation.

Some critics say that JavaScript is not really object-oriented because it cannot provide information hiding. That is, the object cannot have private variables and private methods: all members are public. S

But it proves that JavaScriptObjects can have private variables and private methods.. Of course, few people realize that JavaScript is the most misunderstood program in the world!

In addition, JavaScript cannot provide inheritance,This proves that JavaScriptIt not only supports traditional inheritance, but also applies other code reuse modes..

copyright 2001 Douglas crockford. All Rights Reserved wrrrldwide.

Related Article

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.