2011-12-28

Why do some JavaScript methods have such long names?

Allen Wirfs-Brock (the project editor of the ECMAScript 5 specification) recently mentioned the thought process behind method names such as Object.getOwnPropertyNames():
The thought process that went into choosing the names in ECMAScript 5 was that functions that were viewed as meta level operations that would primarily be used by fairly sophisticated library designers were given long multiword names, e.g. Object.getOwnPropertyNames. Functions that were viewed as application level operations that would be widely used by app developers where given short names, e.g. Object.keys and Object.create.

The assumption was that the meta level operations would be used by library writers to create new app level operations that normally would have short everyday names. Also, the long names minimized the chance that the names would conflict with existing libraries or applications.

No comments: