Archive for August, 2008
Thursday, August 21st, 2008
Lazy Function Definition is a pattern of functional JavaScript programming, similar to Load Time Configuration. The key difference is that the final function value isn’t configured at load time, but rather upon the first invocation of the function.
The Lazy Function Definition pattern was discovered and named by Peter Michaux.
Motivation
Generally there are two main reasons for [...]
Posted in Code, Design Patterns, JavaScript | 4 Comments
Tuesday, August 19th, 2008
The Module is a brilliant design pattern which demonstrates the elegance of the JavaScript language by exploiting closure (one of JavaScript’s most powerful features) to create private members. The Module makes use of Self-invocation making it useful as an application wrapper.
This pattern was originally discovered and named by Douglas Crockford.
Motivation
By default, there is no natural [...]
Posted in Code, Design Patterns, JavaScript | No Comments
Monday, August 18th, 2008
Load time configuration is the process where a JavaScript application configures itself as it is being loaded. This pattern is most commonly found in libraries in which they configure themselves at load time to be optimized for a particular browser.
Load time configuration is also known as load time branching.
Motivation
The primary motivation behind load time configuration [...]
Posted in Code, Design Patterns, JavaScript | 1 Comment
Sunday, August 17th, 2008
I would like to begin this series of posts with one of the most useful and commonplace patterns in my code. Arguably, this can be considered a feature of the JavaScript language rather than a design pattern; however, when considering the contexts in which it is applied, I regard it as a pattern.
Self-invocation (also known [...]
Posted in Code, Design Patterns, JavaScript | 1 Comment