I've been told namespaces shouldn't be used, as they 'pollute' the global scope. I wonder what are the alternatives?
When I want to define utility functions and / or constants e.g. for a website, a simple way to go would be to define them by namespaces, that way the damage to the global scope is restricted to one object only.
If namespaces are bad practice, a couple of questions comes to mind:
- Why is this bad practice?
- What's the scope of this declaration (web applications / dynamic websites / static websites etc.)?
- What are the alternatives?
This question is a result of a discussion started on a post on the benefits of using extend.js.
->they are good). – Felix Kling Apr 7 '12 at 11:52