"Objects" in the classic "JavaScript Authority Guide" are not classic

Source: Internet
Author: User
Tags constructor
javascript| objects

These days write the "JavaScript-oriented support" article for the Qomo project. The "JavaScript Authority Guide" (fourth edition), which is expected to be purchased online, is fast approaching.

The former company, which has the second or third edition of the book, has always regarded the book as a classic. But there was no in-depth look at the conceptual narrative of the previous chapters, but instead looked at it as a handbook. It is now deliberately focused, because the bottom of the Qomo is based on purely theoretical oop.

The book was finally sent to us today, but I was disappointed when I read it. Not knowing the author's ability to understand JavaScript is not enough, or his understanding of OOP is not enough. The "JavaScript Authority Guide", the book's object-oriented narrative, is not only unprofessional but also riddled with bugs. It's not worth a look.

Try to cite a few examples:

Xjavascript has no formal concept of class, ..., it simulates classes with constructors and prototype objects
In fact, JavaScript does not have a formal concept of classes, but the mock class is just a constructor rather than a class. Because the class is "declaration", the object is an entity. Using "entity" to simulate "statement" would have made no sense. In JScript, the detection of a class is done by means of a constructor rather than a prototype based detection.

Instance properties in Xjavascript are those that are created or initialized with constructors in an object
This problem arises in the so-called "instance attribute", which has nothing to do with the constructor, that is, to declare the prototype property directly. For example, "MyObject.prototype.prop_1 = ' abcd '", so the above definition is incomplete.

X class Properties and class methods
There is no "class" in JavaScript, so there are no class attributes and class methods. Only constructors (functions) are also understood by object systems as "objects", so constructors can also create new properties and methods. This is just a feature of a "separate object instance", which is illogical as a class attribute and a class method.

There are so many problems like this that the author's logic is confusing. The author does not even have a way to clarify the similarities and differences between the scripting environment and the DOM environment for the reader, which is particularly prominent in the fourth chapter discussion on the issues of local variables, execution environment and scope (4.6~4.7 section).

So I'm sure not many people can read this book about the description of the object system in JavaScript. In addition, the book combines JavaScript, DOM, and CSS at different levels of the system to say that, although the content of the book is more rich and stimulate the purchase, but also so that readers have to jump in a few different mud pits, and ultimately confused.

Therefore, as a suggestion, it is best to refer to this book as a handbook rather than as a theoretical classic. To say the least, it is not the fault of the interpreter, but it is the author's problem.

The translation of Delphi Technology Handbook from the same publishing house was badly scolded by some people, but in fact it was nonsense for those who couldn't read the book. The translation of the book is very fine, some seemingly clumsy translations are actually very accurate, read more than two times to understand. In contrast, the author of this "JavaScript Authority Guide" does not seem to have a thorough 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.