Connexions

Sections
You are here: Home » Content » Namespace pattern

About: Namespace pattern

Module by: Hannes Hirzel. E-mail the author

View the content: Namespace pattern

Metadata

Name: Namespace pattern
ID: m42782
Language: English (en)
Summary: This modules explains how to avoid having too many global variables in JavaScript programs. This is accomplished by using the 'namespace pattern'. This pattern is used in many libraries.
Subject: Science and Technology
Keywords: design pattern, global variable, JavaScript, JavaScript programming, namespace pattern, software engineering
License: Creative Commons Attribution License CC-BY 3.0

Authors: Hannes Hirzel (hannes.hirzel@gmail.com)
Copyright Holders: Hannes Hirzel (hannes.hirzel@gmail.com)
Maintainers: Hannes Hirzel (hannes.hirzel@gmail.com)

Latest version: 1.5 (history)
First publication date: Jan 25, 2012 4:42 am -0600
Last revision to module: Feb 11, 2012 3:08 am -0600

Downloads

PDF: m42782_1.5.pdf PDF file, for viewing content offline and printing. Learn more.
EPUB: m42782_1.5.epub Electronic publication file, for viewing in handheld devices. Learn more.
XML: m42782_1.5.cnxml XML that defines the structure and contents of the module, minus any included media files. Can be reimported in the editing interface. Learn more.
Source Export ZIP: m42782_1.5.zip ZIP containing the module XML plus any included media files. Can be reimported in the editing interface. Learn more.

Version History

Version: 1.5 Feb 11, 2012 3:08 am -0600 by Hannes Hirzel
Changes:
added 'this' in the code example; added link to pattern book by Addy Osmani.

Version: 1.4 Feb 6, 2012 12:40 pm -0600 by Hannes Hirzel
Changes:
Added prerequisite link to module 'variable declaration'

Version: 1.3 Feb 4, 2012 3:03 pm -0600 by Hannes Hirzel
Changes:
Added link to Opera Dev website

Version: 1.2 Jan 27, 2012 3:31 am -0600 by Hannes Hirzel
Changes:
clarifications in the intro; changed section title from 'Implementation' to 'Solution'. Change code snippet to console.log('within the "open" function');

Version: 1.1 Jan 27, 2012 12:56 am -0600 by Hannes Hirzel
Changes:
Created module: first draft

How to Reuse and Attribute This Content

If you derive a copy of this content using a Connexions account and publish your version, proper attribution of the original work will be automatically done for you.

If you reuse this work elsewhere, in order to comply with the attribution requirements of the license (CC-BY 3.0), you must include

  • the authors' names: Hannes Hirzel
  • the title of the work: Namespace pattern
  • the Connexions URL where the work can be found: http://cnx.org/content/m42782/1.5/

See the citation section below for examples you can copy.

How to Cite and Attribute This Content

The following citation styles comply with the attribution requirements for the license (CC-BY 3.0) of this work:

American Chemical Society (ACS) Style Guide:

Hirzel, H. Namespace pattern, Connexions Web site. http://cnx.org/content/m42782/1.5/, Feb 11, 2012.

American Medical Assocation (AMA) Manual of Style:

Hirzel H. Namespace pattern [Connexions Web site]. February 11, 2012. Available at: http://cnx.org/content/m42782/1.5/.

American Psychological Assocation (APA) Publication Manual:

Hirzel, H. (2012, February 11). Namespace pattern. Retrieved from the Connexions Web site: http://cnx.org/content/m42782/1.5/

Chicago Manual of Style (Bibliography):

Hirzel, Hannes. "Namespace pattern." Connexions. February 11, 2012. http://cnx.org/content/m42782/1.5/.

Chicago Manual of Style (Note):

Hannes Hirzel, "Namespace pattern," Connexions, February 11, 2012, http://cnx.org/content/m42782/1.5/.

Chicago Manual of Style (Reference, in Author-Date style):

Hirzel, H. 2012. Namespace pattern. Connexions, February 11, 2012. http://cnx.org/content/m42782/1.5/.

Modern Languages Association (MLA) Style Manual:

Hirzel, Hannes. Namespace pattern. Connexions. 11 Feb. 2012 <http://cnx.org/content/m42782/1.5/>.