JavaScript-the most misunderstood language analysis in the world

Source: Internet
Author: User

JavaScript is one of the most popular programming languages in the world.. In fact, every personal computer in the world is installed and at least one Jav is frequently used.AScript interpreter. The popularity of JavaScript is entirely due to hisThe position in the WWW scripting language field is determined.

Despite its popularity, few know that JavaScript is a very nice dynamic object-oriented general-purpose programming language. How can this be a secret? Why is this language so misunderstood?

Although it is very popular, few people know that JavaScript is very good.Dynamic object-oriented general programming language. This actually becomes a secret.! Why is this language so misunderstood?

The Name

Name

TheJava-Prefix suggests that JavaScript is somehow related to Java, that it is a subset or less capable version of Java. it seems that the name was intentionally selected to create confusion, and from confusion comes misunderstanding. javaScript is not interpreted Java. java is interpreted Java. javaScript is a different language.

Java-the prefix is easy for people to think of Java and considers it a subset or simplified version of Java.Java. It seems that this name was chosen with ulterior motives., Intentionally obfuscation of concepts and deliberately creating "Misunderstandings. JavaScript is notExplain the executed Java. Java is the Java. JavaScript is another language.

JavaScript has a syntactic similarity to Java, much as Java has to C. but it is no more a subset of Java than Java is a subset of C. it is better than Java in the applications that Java (fka Oak) was originally intended.

The syntax of JavaScript is similar to that of Java., Which is similar to Java syntax and C syntax. But it is not a subset of Java., Just as Java is not a subset of C. In Java (Oak) It is better than Java in the first field.

JavaScript was not developed at Sun Microsystems, the home of Java. JavaScript was developed at Netscape. It was originally called LiveScript, but that name wasn' t confusing enough.

JavaScript is not a product of Sun Microsystems, and Sun is a Java product.. JavaScript is developed in Netscape.. It was originally called LiveScript ...... The name is better.

The-ScriptSuffix suggests that it is not a real programming language, that a scripting language is less than a programming language. but it is really a matter of specialization. compared to C, JavaScript trades performance for expressive power and dynamism.

-The Script suffix makes people think that it is not a real programming language, and a "Programming Language""There is a considerable gap. However, this is only a problem in the application field. Compared with CJavaScript sacrifices performance, but in exchange for rich expressiveness and flexibilityForm.

Lisp in C's Clothing

Lisp in C skin

JavaScript's C-like syntax, including curly braces and the clunkyForStatement, makes it appear to be an ordinary procedural language. this is misleading because JavaScript has more in common with functional versions like Lisp or Scheme than with C or Java. it has arrays instead of lists and objects instead of property lists. functions are first class. it has closures. you get lambdas without having to balance all those parens.

JavaScript Class C syntax, including braces and statement formsTo make it look like a common process-oriented programming language. This is a misunderstanding.Because JavaScript and functional languages, such as Lisp or Scheme, have more similarities than C or Java. It uses arrays instead of lists., Object instead of attribute list. The function is the first, and it has a closure.(Closures). You can also use lambda expressions.

Typecasting

Type conversion

JavaScript was designed to run in Netscape Navigator. its success there led to it becoming standard equipment in virtually all web browsers. this has resulted in typecasting. javaScript is the George Reeves of programming ages. javaScript is well suited to a large class of non-Web-related applications

JavaScript was initially designed to run in Netscape Navigator, And it successfully leads it in NavigatorAs a matter of fact, all web browsers are equipped with standard equipment. This creates "type conversion". JavaScript is George Reeves (Superman) in programming languages and is a good choice for a large number of non-web programs.

Moving Target

Mobile target

The first versions of JavaScript were quite weak. they lacked exception handling, inner functions, and inheritance. in its present form, it is now a complete object-oriented programming language. but when opinions of the language are based on its immature forms.

The first few versions of JavaScript are very weak with no exception handling, No internal functions and inheritance. Nowadays, it has become a fully object-oriented programming language.. However, many ideas of this language are based on its immature form.

The ECMA committee that has stewardship over the language is developing extensions which, while well intentioned, will aggravate one of the language's biggest problems: There are already too limit versions. This creates confusion.

The ECMA committee, the manager of the language, is expanding it and is deliberately deteriorating its biggest problem: There are too many versions. This is the root cause of chaos.

Design Errors

Design Error

No programming language is perfect. JavaScript has its share of design errors, such as the overloading+To mean both addition and concatenation with type coercion, and the error-proneWithStatement shoshould be avoided. the reserved word policies are much too strict. semicolon insertion was a huge mistake, as was the notation for literal regular expressions. these mistakes have led to programming errors, and called the design of the language as a whole into question. fortunately, cannot of these problems can be mitigated with a good lint program.

No programming language is perfect. JavaScript also has design errors.For example, the overloaded + signs indicate "addition" and "connection" with different types", And the with statement to avoid errors. Its reserved word policy is too strictGrid. The insertion of semicolons is a huge error, for example, when it is used as a symbol of a literal regular expression. These mistakes have directly led to programming errors and the overall design of the language has beenPeople question. Fortunately, many of these problems can be mitigated in good lint programs.

The design of the language on the whole is quite sound. Surprisingly, the ECMAScript committee does not appear to be interested in correcting these problems. Perhaps they are more interested in making new ones.

The overall design of this language (the problem above) is quite obvious. It's strange that the ECMAScript CommitteeWill not show much interest in fixing the problems, maybe they are more keen onCreate new problems.

Lousy Implementations

Poor implementation

Some of the earlier implementations of JavaScript were quite buggy. This reflected badly on the language. Compounding that, those implementations were embedded in horribly buggy web browsers.

Some early implementations of JavaScript have many bugs.In turn, this has a bad influence on the language itself. Even worse, these are full of bugs.Is embedded in a web browser full of bugs.

Bad Books

Bad books

Nearly all of the books about JavaScript are quite awful. they contain errors, poor examples, and promote bad practices. important features of the language are often explained poorly, or left out entirely. I have reviewed dozens of JavaScript books, andI can only recommend one:JavaScript: The Definitive Guide (4th Edition)By David Flanagan. (Attention authors: If you have written a good one, please send me a review copy .)

Almost all JavaScript books are terrible. They contain errorsContains bad examples and encourages bad practices. JavaScriptThey are either not clearly explained or not mentioned at all.. I have read many JavaScript books, but I can only recommend one.: David Flanagan'sJavaScript: The Definitive Guide (4th Edition)(Version 4 of the JavaScript authoritative guide). (Attention: If you have written a good book, please send me a copy and I will proofread it for you .)

Substandard Standard

"Quasi-standard" Standards

The official specification for the language is published by ECMA. the specification is of extremely poor quality. it is difficult to read and very difficult to understand. this has been a contributor to the Bad Book problem because authors have been unable to use the standard document to improve their own understanding of the language. ECMA and the TC39 committee shoshould be deeply embarrassed.

The quality of official language specifications published by ECMA is extremely poor. Not only difficult to read but also extremely difficult to understand. It can be for those "bad books""I have made a great contribution because those authors cannot use this standard document to make a deeper geographicThis language. ECMA and TC39 should be very embarrassing.

Amateurs

Amateurs

Most of the people writing in JavaScript are not programmers. they lack the training and discipline to write good programs. javaScript has so much expressive power that they are able to do useful things in it, anyway. this has given JavaScript a reputation of being strictly for the amateurs, that it is not suitable for professional programming. this is simply not the case.

Most of the people who use JavaScript are not programmers. They lack good programming skills.Training and training. JavaScript is very expressive.They can also use it to do useful things in any case. This gives JavaScript 1He is well known as "perfect for amateurs rather than professional programmers. This is obviously an error.Error.

Object-Oriented

Object-oriented

Is JavaScript object-oriented? It has objects which can contain data and methods that act upon that data. objects can contain other objects. it does not have classes, but it does have constructors which do what classes do, including acting as containers for class variables and methods. it does not have class-oriented inheritance, but it does have prototype-oriented inheritance.

Is JavaScript object-oriented? It has objects, and its objects can containData and methods for operations on data. Objects can also contain other objects.. It does not have a class, but it has constructors for class operations, including declaring class variables andMethod. It does not have class-oriented inheritance, but it has prototype-oriented inheritance.

The two main ways of building up object systems are by inheritance (is-a) and by aggregation (has-). javaScript does both, but its dynamic nature allows it to excel at aggregation.

The two main methods for building an object system are inheritance (is-a) and aggregation (has ).-). Both have JavaScript, but its dynamic nature allowsBetter implementation than aggregation.

Some argue that JavaScript is not truly object oriented because it does not provide information hiding. That is, objects cannot have private variables and private methods: All members are public.

Some arguments about JavaScript is not really object-oriented because it does notProvides information hiding. That is to say, JavaScript objects do not have private variables.And Private method: all its members are public.

But it turns out that JavaScript objectsCanHave private variables and private methods. (Click here now to find out how.) Of course, few understand this because JavaScript is the world's most misunderstood programming language.

But the fact is that JavaScript objects can have private variables and private methods (Click here to see how to implement them ). Of course, few people know this because JavaScript is the world.The most misunderstood language.

Some argue that JavaScript is not truly object oriented because it does not provide inheritance. But it turns out that JavaScript supports not only classical inheritance, but other code reuse patterns as well.

Another reason JavaScript is not really object-oriented is that it does not provide inheritance. However, JavaScript not only supports classic inheritance, but also supports other code reuse modes.

I think this article is very good. I will repost it and share it with you.

Http://www.crockford.com/javascript/javascript.html

Http://blog.csdn.net/uoyevoli/archive/2006/05/19/744915.aspx Translator: Yuan Xiaohui

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.