JavaScript is one of the most popular programming languages in the world. Virtually every personal computer in the world is installed and frequently uses at least one JAVascript interpreter. The popularity of JavaScript is entirely due to his position in the world of WWW scripting language.
Despite its popularity, few know that JavaScript are a very nice dynamic object-oriented general-purpose programming Langua Ge. How can I be a secret? Why is this language so misunderstood?
Although it's popular, few people know that JavaScript is a great dynamic object-oriented programming language. This could be a secret ! Why is this language so misunderstood?
The Name
name
The java- prefix suggests that JavaScript are somehow related to Java, which it is a subset or less capable version of Java. It seems that name is intentionally selected to create confusion, and from confusion comes. JavaScript is not interpreted Java. Java is interpreted java. JavaScript is a different language.
The java-prefix is easy to associate with Java and is considered a subset of Java or a simplified version of Java. It seems that the original name was chosen for ulterior motives, deliberately confusing concepts and deliberately creating "misunderstandings". JavaScript is not Java that interprets execution. Java is Java that interprets execution. JavaScript is another language.
JavaScript has a syntactic similarity to Java, much as Java has to C. But It is no. A subset of Java than Java is a subset of C. It is better than Java in the applications this Java (FKA Oak) was originally intended for.
JavaScript syntax is similar to Java, which is like Java syntax and C. But it's not a subset of Java, just like Java is not a subset of C. It is better than Javain the domain in which Java (Oak) originally intended to March.
JavaScript is not developed at Sun Microsystems, the home of Java. JavaScript is developed at Netscape. It is originally called LiveScript, but that name wasn ' t confusing enough.
JavaScript is not a product of Sun Microsystems, Sun is the home of Java. JavaScript was developed in Netscape . It was originally called LiveScript, um ... It's still a good name.
The -script suffix suggests that it isn't a real programming language and that's scripting language is less than a Programming language. But It is really a matter of specialization. Compared to C, the JavaScript trades performance for expressive power and dynamism.
-script suffix makes people think he is not a real programming language, and a "programming language " There is a considerable gap. But this is only a matter of application. Compared with C, JavaScript is sacrificing performance but in exchange for rich expressiveness and flexible forms.
Lisp in C ' s clothing
with a C-Skin lisp.
JavaScript ' s c-like syntax, including curly braces and the clunky for statement, makes it appear to is an Ordinar Y procedural language. This is misleading because JavaScript has the more in common with functional languages like Lisp or Scheme than with C or Java . It has arrays instead of lists and objects instead of the property lists. Functions are the class. It has closures. You get lambdas without has to balance all those parens.
Class C syntax for JavaScript, including curly braces and the form of statements And make it look like a common programming language for the process. It's a misunderstanding. , because JavaScript and functional languages, such as Lisp or Scheme, have more similarities than C or Java. It uses arrays rather than lists , use an object instead of a list of attributes. The function is first, it has a closure (closures), and you can also use lambda expressions.
Typecasting
Type Conversions
JavaScript is designed to run in Netscape Navigator. Its success there led to it becoming standard equipment in virtually all Web browsers. This is has resulted in typecasting. JavaScript is the George Reeves of programming languages. JavaScript is-suited to a large class of non-web-related applications
JavaScript was originally designed to run in Netscape Navigator, and its success in navigator led it to become the standard equipment for virtually all Web browsers. This creates a "type conversion". JavaScript is George Reeves (Superman) in the programming language, and is a good choice for a large number of non-web programs.
Moving Target
Moving Targets
The versions of JavaScript were quite weak. They lacked exception handling, inner functions, and inheritance. In the present form, it is now a complete object-oriented programming language. But Many opinions of the language are based on its immature forms.
The first few versions of JavaScript are very weak, with no exception handling, no intrinsic functions, and no inheritance. Today, it has become a fully object-oriented programming language . But many of the ideas of the language are based on its immature form.
The ECMA committee that has stewardship over the language are developing extensions, while at which, would intentioned Ravate one of the language ' s biggest problems:there are already too many. This creates confusion.
The ECMA Committee, the housekeeper of the language, is expanding it and is deliberately exacerbating its biggest problem : There are too many versions. This is the root of chaos.
Design Errors
errors in the design
No programming language is perfect. JavaScript has its share of design errors, such as the overloading of + to mean both addition and concatenation W ITH type coercion, and the Error-prone with statement should is avoided. The reserved word policies are much too strict. Semicolon insertion was a huge mistake, as is the notation for literal regular. These mistakes have LEDs to programming errors, and called the "the language as a whole into question." Fortunately, many of these problems can is mitigated with a good lint.
No programming language is perfect. JavaScript also has its design errors, such as the overloaded + number as a type of difference between the "add" and "Connection", and should be avoided with the error-prone with statement. Its reserved word policy is too restrictive . The insertion of semicolons is a huge error, such as when you are a symbol of a literal regular expression. These mistakes have led directly to programming errors and have made the overall design of the language questionable. Fortunately, many of these problems can be alleviated in a good lint program.
The design of the language in the whole is quite sound. Surprisingly, the ECMAScript committee does not appear to is interested in correcting these problems. Perhaps they are more interested in making new ones.
The overall design of the language (the problem) is quite obvious. Oddly enough, the ECMAScript committee has not shown much interest in correcting the problems that exist, and perhaps they are more interested in creating new problems.
Lousy implementations
a bad implementation
Some of the earlier implementations of JavaScript were quite buggy. This is reflected badly on the language. Compounding that, those implementations were embedded in horribly buggy Web browsers.
Some of the early implementations of JavaScript havemany bugs, which in turn have a bad effect on the language itself. Worse, the implementation of these bugs is embedded in a bug-filled web browser.
Bad books
Bad book.
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, or left out poorly. I have reviewed dozens of JavaScript books, and I can only recommendone: javascript:the definitive Guide (4 Th Edition) by David Flanagan. (Attention authors:if You have written a good one, please send me a review copy.)
Almost all of the JavaScript books are pretty scary. They contain errors , contain bad examples, and encourage bad practices. Some of the important features of JavaScript language they are either not explained clearly or are not mentioned at all. I've read a lot of JavaScript books, but I can only recommend one: David Flanagan's javascript:the definitive Guide (4th Edition) ( JavaScript Authority Guide, fourth Edition). (Please note : If you have written a good book, please send me a copy and I will proofread it for you.) )
Substandard Standard
standard of "quasi-standard"
The official specification for the language was published by ECMA. The specification is the 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 Impro ve their own understanding of the language. ECMA and the TC39 committee should be deeply embarrassed.
The quality of the official language standard published by ECMA is extremely poor. Not only difficult to read but also extremely difficult to understand. It can make a great contribution to those "bad books" because those authors cannot use this standard document to further geography the language. ECMA and TC39 should be very embarrassed about this.
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 in it, things. This has given JavaScript a reputation of being strictly for the amateurs, which it is isn't suitable for professional Mming. This isn't simply the case.
Most people who use JavaScript are not programmers, and they lack the training and training to write good programs. JavaScript has a very powerful expressiveness , and they can use it to do useful things anyway. This gives JavaScript a reputation as a "perfect fit for amateurs and not for professional programmers." This is clearly a mistake .
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 did, classes including as acting for class Variables and methods. It does not have class-oriented inheritance, but it does have prototype-oriented.
is JavaScript object-oriented? It has objects, its objects can contain data and methods to manipulate the data, and objects can contain other objects. It has no class, but it has constructors to do the things of the class, including declaring the class's variables and the square method. It has no class-oriented inheritance, but he has prototype-oriented inheritance.
The two main ways of building up object systems are by inheritance (IS-A) and by Aggregation (HAS-A). JavaScript does both, but its dynamic is allows it to excel at aggregation.
The two main methods of building an object system are inheritance (IS-A) and aggregation (has-a). Both are JavaScript, but its dynamic nature allows for better implementations than aggregation.
Some argue that JavaScript isn't truly object oriented because it does not provide information. That's, objects cannot have private variables and private Methods:all members are public.
Some of the argument that JavaScript is not really object-oriented is that it does not provide information hiding. This means that JavaScript objects do not have private variables and private methods: All of its members are public.
But it turns out that JavaScript objects can have private variables and private methods. (Click here today to find out how.) Of course, few understand this because JavaScript are the world's most misunderstood the programming language.
But the fact is that JavaScript objects can have private variables and private methods (click here to see how it is implemented). Of course, few people know this because JavaScript is the most misunderstood language in the world.
Some argue that JavaScript isn't truly object oriented because it does not provide. But It turns out this JavaScript supports not only classical inheritance, But the other code reuse patterns as.
Another reason why JavaScript is not really an object-oriented argument is that it does not provide inheritance. But the fact is that JavaScript not only supports classic inheritance, but it also supports some other patterns of code reuse.
Think this article is very good, reprinted to share with you.
English address:http://www.crockford.com/javascript/javascript.html
Address: http://blog.csdn.net/uoyevoli/archive/2006/05/19/744915.aspx Translator: Shaohui