Namespace

In computing, a namespace is a set of signs (names) that are used to identify and refer to objects of various kinds. A namespace ensures that all of a given set of objects have unique names so that they can be easily identified.

Namespaces are commonly structured as hierarchies to allow reuse of names in different contexts. As an analogy, consider a system of naming of people where each person has a given name, as well as a family name shared with their relatives. If the first names of family members are unique only within each family, then each person can be uniquely identified by the combination of first name and family name; there is only one Jane Doe, though there may be many Janes. Within the namespace of the Doe family, just "Jane" suffices to unambiguously designate this person, while within the "global" namespace of all people, the full name must be used.

Prominent examples for namespaces include file systems, which assign names to files.[1] Some programming languages organize their variables and subroutines in namespaces.[2][3][4] Computer networks and distributed systems assign names to resources, such as computers, printers, websites, and remote files. Operating systems can partition kernel resources by isolated namespaces to support virtualization containers.

Similarly, hierarchical file systems organize files in directories. Each directory is a separate namespace, so that the directories "letters" and "invoices" may both contain a file "to_jane".

In computer programming, namespaces are typically employed for the purpose of grouping symbols and identifiers around a particular functionality and to avoid name collisions between multiple identifiers that share the same name.

In networking, the Domain Name System organizes websites (and other resources) into hierarchical namespaces.

  1. ^ Adya, Atul; Bolosky, William; Castro, Miguel; Cermak, Gerald; Chaiken, Ronnie; Douceur, John; Howell, Jon; Lorch, Jacob; Theimer, Marvin; Wattenhofer, Roger (2002). FARSITE: Federated, Available, and Reliable Storage for an Incompletely Trusted Environment (PDF). Proc. USENIX Symp. on Operating Systems Design and Implementation. Archived from the original (PDF) on 2010-07-28. The primary construct established by a file system is a hierarchical directory namespace, which is the logical repository for files.
  2. ^ "C# FAQ: What is a namespace". C# Online Net. Archived from the original on 2013-10-20. Retrieved 2010-02-23. A namespace is nothing but a group of assemblies, classes, or types. A namespace acts as a container—like a disk folder—for classes organized into groups usually based on functionality. C# namespace syntax allows namespaces to be nested.
  3. ^ "An overview of namespaces in PHP". PHP Manual. What are namespaces? In the broadest definition, namespaces are a way of encapsulating items. This can be seen as an abstract concept in many places. For example, in any operating system directories serve to group related files, and act as a namespace for the files within them.
  4. ^ "Creating and Using Packages". Java Documentation. Oracle. A package is a grouping of related types providing access protection and name space management. Note that types refers to classes, interfaces, enumerations, and annotation types. Enumerations and annotation types are special kinds of classes and interfaces, respectively, so types are often referred to in this lesson simply as classes and interfaces.[better source needed]