Namespace
What is Namespace?
Namespace: A logical grouping that organises identifiers (classes, functions, variables) to avoid naming conflicts. In Kubernetes, namespaces isolate resources within a cluster. A namespace groups names together so they do not clash. In PHP, App\Models\User and Vendor\Package\User can both exist, because they live in different namespaces. JavaScript modules, Python packages and Java packages solve the same problem.
Frequently asked questions about Namespace
How is Namespace used in practice?
Namespaces also organise code. Combined with autoloading in PHP, the namespace usually mirrors the folder structure, so you can tell where a class lives from its full name.
What should you keep in mind with Namespace?
In Kubernetes, the word means something related: a namespace separates resources inside one cluster, such as staging and production, or different teams. Names only need to be unique within a namespace. In both cases, a clear and consistent naming scheme from the start saves a lot of renaming later.
At a glance
| Category | Core glossary |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |