Monday, November 9, 2009

Modern JavaScript

Google's first production server rack, circa 1999Image via Wikipedia

These are exciting days for JavaScript, my note in Google Reader:
Crockford's _JavaScript: The Good Parts_ + jQuery + Google's Closure Library + Compiler = the best of modern Javascript
Very interesting article by Michael Bolin that shows what Google's Closure Library + Compiler bring to the table, and how you might change your clean JavaScript coding style:
Inheritance Patterns in JavaScript: "The Closure Library makes use of the pseudoclassical inheritance pattern,which is particularly compelling when used with the Closure Compiler.Those of you who have read JavaScript: The Good Parts by Douglas Crockford may use the functional pattern for inheritance that he espouses.

Cover of Cover of JavaScript: The Good Parts

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.'

This article discusses the advantages of the pseudoclassical pattern over the functional pattern. I argue that the pattern used by the ClosureLibrary paired with the Closure Compiler removes existing hazards while I also examine the hazards introduced by the functional pattern (as defined in The Good Parts)."

Reblog this post [with Zemanta]

No comments: