in reply to Re: Are global variables "bad"?
in thread Are global variables "bad"?
Perhaps a better way to say it is not that globals are bad, but that globals are easy to use badly.
I often find that I am suspicious when I run across global variables (and now Singletons) in code that is larger than a single script. I know (from much painful experience) that the globals are likely to be the focus of surprising behavior from changes due to unrelated code.
Personally, I learned this not from any CS classes, but from being bitten a few times too many.
|
|---|