The "object" in the classic JavaScript authoritative guide is not classic

Source: Internet
Author: User

These days I wrote this set of articles "javascript object-oriented support" for the qomo project. I have always been looking forward to the upcoming JavaScript authoritative guide (version 4.

In previous companies, the second or third edition of this book has always regarded this book as a classic. However, at that time, I did not go into the conceptual descriptions in the previous chapters, but I used them as a manual for reference. Now, I have deliberately paid attention to it, because the underlying layer of qomo is based on pure theoretical oop.

Today, this book was finally delivered, but I was disappointed to read it. I don't know if the author has insufficient understanding of the Javascript language, or does not have enough understanding of OOP. The javascript authoritative guide book not only does not provide a professional description of object orientation, but also provides hundreds of errors. It's really not worth looking.

Examples:

× JavaScript does not have a formal class concept ,......, ItSimulate the class with constructors and prototype objects
In fact, JavaScript does not have a formal concept of classes, but the simulation class only involves constructors, not prototype objects. Because the class is a "Declaration", the object is an entity. It is impossible to simulate "declaration" with "entity. In JScript, class detection is performed by constructor, rather than a prototype-based detection.

× The instance attributes in JavaScript are those in the objectAttributes created or initialized using Constructors
This problem occurs when the so-called "instance attribute" is not related to the constructor, that is, the prototype attribute is directly declared. For example, "myobject. Prototype. prop_1 = 'abc'", so the above definition is incomplete.

×Class attributesAndClass Method
JavaScript does not contain "classes", so there are no class attributes and class methods. The constructor (function) is also understood as an "object" by the object system. Therefore, the constructor can also create new attributes and methods. -- This is just a feature of "single object instance". It is not logical to regard this as a Class Attribute and class method.

There are a lot of problems like this, and the logic of the author is quite messy. The author cannot even clarify the similarities and differences between the script environment and the DOM environment for the reader. In chapter 4, we will discuss local variables, execution environment, and scope (4.6 ~ Section 4.7.

Therefore, I believe that few people can understand the description of the Object System in JavaScript. In addition, this book brings together several different levels of systems, JavaScript, Dom, and CSS. Although this book is richer and more exciting to purchase, however, it also forces the reader to jump across several different traps, so that the reader is at a loss.

Therefore, we recommend that you use this book as a manual instead of a theoretical classic. To put it simply, this is not a translation fault, but the author's problem.

The translation of "Delphi Technical Manual" from the same publishing house has been scolded by some people, but in fact it is the case that people do not understand the book. -- The translation of that book is very accurate. Some seemingly fluent translations are actually very accurate. You can simply read them twice. In comparison, the author of this JavaScript authoritative guide seems to have a deep understanding and thought about the "JavaScript Object System.

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.