Chapter 5. Object Creation Patterns
We take a look at namespacing, dependency declaration, module pattern, and sandbox patterns—they help you organize and structure your application code and mitigate the effect of the implied globals. Other topics of discussion include private and privileged members, static and private static members, object constants, chaining, and one class-inspired way to define constructors.
Namespaces help reduce the number of globals required by our programs and at the same time also help avoid naming collisions or excessive name prefixing.
Consider the following example: ...