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.
Operating systems can partition kernel resources by isolated namespaces to support virtualization containers.
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.
The following XML distinguishes between information about the HTML table and furniture by prefixing "h" and "f" at the beginning of the elements.
Delegation of responsibilities between parties is important in real-world applications, such as the structure of the World Wide Web.
Namespaces allow delegation of identifier assignment to multiple name issuing organisations whilst retaining global uniqueness.
[8] A central Registration authority registers the assigned namespace names allocated.
Below is an example of a namespace in C++: A namespace in computer science (sometimes also called a name scope) is an abstract container or environment created to hold a logical grouping of unique identifiers or symbols (i.e. names).
In this analogy, the ID number is the identifier, and the company serves as the namespace.
In large computer programs or documents it is common to have hundreds or thousands of identifiers.
They provide a means of grouping logically related identifiers into corresponding namespaces, thereby making the system more modular.
Data storage devices and many modern programming languages support namespaces.
By adding the line to a piece of code, the prefix abc:: is no longer needed.
However the use of the using directive for reasons other than backwards compatibility (e.g., convenience) is considered to be against good code practices.
Like C++, Java offers a construct that makes it unnecessary to type the package name (import).
For example, all packages beginning with java are a part of the Java platform—the package java.lang contains classes core to the language, and java.lang.reflect contains core classes specifically relating to reflection.
Function and class scopes can be viewed as implicit namespaces that are inextricably linked with visibility, accessibility, and object lifetime.
Furthermore, custom namespaces are extensively used by programmers, both to organize their work and to avoid naming collisions.
For example, C libraries such as libpng often use a fixed prefix for all functions and variables that are part of their exposed interface.