in reply to Are global variables "bad"?
Saying "Global variables are bad!", is like saying "Drugs are bad!". Used wrongly they can be harmful. Used correctly they are a powerful good.
And remember, entries in the symbol table are just global variables. So, if you substitute a 'singleton' instance, for a global variable, you are just substituting (at least) one global variable for another. And making your code far more complicated to boot.
If you need global access to something, use a global variable. It's cleaner, clearer and safer.
Like 'democracies' in which only one party is allowed, classes in which only one instance is allowed, are just a sham, putting a politically acceptable face on the truth.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Are global variables "bad"?
by Argel (Prior) on Apr 22, 2009 at 01:07 UTC | |
by BrowserUk (Patriarch) on Apr 22, 2009 at 02:42 UTC | |
by jpearl (Scribe) on Apr 22, 2009 at 13:53 UTC |