JavaScript,是世界上最流行的编程语言之一
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?
尽管它很流行,但是很少有人知道JavaScript是一个非常棒
The Java- 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- 前缀很容易使人联想到Java,并认为它是Java的子集或简化版
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 for.
JavaScript的语法和Java有相似之处
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不是Sun Microsystems的产品,Sun是Java的家
The -Script suffix 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.
-Script后缀让人认为他不是一门真正的编程语言,和一门"编程语言
Lisp in C's Clothing
披着C皮的LispJavaScript's C-like syntax, including curly braces and the clunky for statement, makes it appear to be an ordinary procedural language. This is misleading because JavaScript has 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 property lists. Functions are first class. It has closures. You get lambdas without having to balance all those parens.
JavaScript的类C语法,包括大括号和语句的形式
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 languages. JavaScript is well suited to a large class of non-Web-related applications
JavaScript最初被设计成在Netscape Navigator中运行,它在Navigator中的成功引领它
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 many opinions of the language are based on its immature forms.
JavaScript的最初几版非常弱,没有异常处理
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 many versions. This creates confusion.
ECMA委员会,这门语言的管家,正在对它进行扩展,也在蓄意恶化它最大的问题
No programming language is perfect. JavaScript has its share of design errors, such as the overloading of + to mean both addition and concatenation with type coercion, and the error-prone with statement should 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, many of these problems can be mitigated with a good lint program.
没有什么编程语言是完美的。JavaScript也有它设计上的错
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.
这门语言的整体设计(上的问题)是相当明显的。奇怪的是ECMAScript委员
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.
JavaScript的一些早期实现有许多bug
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, and I 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.)
几乎所有的JavaScript书都是相当可怕的。它们包含错误
この言語の公式仕様は ECMA によって公開されていますが、その仕様は非常に質が低く、作成者が使用できないため、これが Bad Book 問題の一因となっています。 ECMA と TC39 委員会は、この言語に対する理解を向上させるための標準文書を作成することを非常に恥じるべきです。
ECMA が発行する公式言語仕様の品質は非常に悪いです。読みにくいだけでなく、理解するのも非常に難しいです。これらの著者はこの標準文書を使用してこの言語をより深く理解できないため、この標準文書はそれらの「悪い本」に大きく貢献します。 ECMA と TC39 はこれについて非常に当惑するはずです。
優れたプログラムを作成するためのトレーニングや訓練を受けていません。 JavaScript は非常に表現力豊かな
であり、それを使用して便利なことを行うことができます。このため、JavaScript は「アマチュアには完全に適しており、プロのプログラマには適していない」という評判が与えられました。これは明らかに間違いです
オブジェクト指向
を含めることもできます。クラスはありませんが、クラス変数やメソッドの宣言など、クラスの処理を行うコンストラクターがあります。クラス指向の継承はありませんが、プロトタイプ指向の継承はあります。
優れた実装が可能になります。
やプライベート メソッドがなく、そのメンバーはすべてパブリックです。
JavaScript は継承を提供しないため、真のオブジェクト指向ではないと主張する人もいます。しかし、JavaScript は古典的な継承だけでなく、他のコードの再利用パターンもサポートしていることが判明しました。
JavaScript が真のオブジェクト指向ではないというもう 1 つの議論は、JavaScript が継承を提供しないことです。しかし実際には、JavaScript は従来の継承をサポートしているだけでなく、他のコードの再利用パターンもサポートしています。
http://www.crockford.com/javascript/javascript.html
中国語翻訳アドレス:
http://blog.csdn.net/uoyevoli/archive/2006/05/19/744915.aspx翻訳者: Yuan Xiaohui