Namespace pollution
giving variables names that can easily collide with others
// updated 2025-05-25 16:01
Namespace pollution occurs when imported code from an external source interferes with (i.e. pollutes) one's code (i.e. namespace) to the point of dysfunction, due to:
- an external source's variable name accidentally matching a target's variable name
- an external source's variable sounding similar to a target's variable name, which can cause confusion to developers
To mitigate namespace pollution, we could:
- make variable names as descriptive and unique as possible (also without making them too long)
- Namespace pollution on Wikipedia