This originally appeared as an article on my website on November 6, 2009.
Crockford appears to object to the pseudoclassical pattern because
“There is no privacy; all properties are public. There is no access to
super methods . . . . Even worse, there is a serious hazard
with the use of constructor functions. If you forget to use the
new prefix when calling a constructor function, then
this will not be bound to a new object . . . . There is no
compile warning, and there is no runtime warning” (p. 49).
Example of the Functional Pattern
The following example demonstrates the style of the functional
pattern for inheritance as explained in Douglas Crockford’s
definition for a
phone type as well as a subtype
var phone ...