Javascript is misunderstood so deeply

Source: Internet
Author: User

Javascript is the most popular in the worldProgramming LanguageOne. 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 easily reminds people 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.

-ScriptSuffix makes people think that he 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 large number of non-WebProgramCompetent candidates.

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"To avoid errors.WithStatement. 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 IOnly one copy can be recommended: 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

"Standard

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 otherCodeReuse mode.

I think this articleArticleVery good. I will 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

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.