Re:Global variables are bad (2013)
by mpartel on Thursday July 26, 2018 @04:14AM
(#17615880)
In general I fully agree, YAGNI and all that, but from experience, mutable globals, unless used very sparingly, rigidify the codebase to a surprising degree and make it more error-prone, often for very little actual gain.
As with any software engineering guideline, there are exceptions. E.g. Java-style loggers are so ubiqitous and "not that mutable", that it's generally good for them to be global.
Edit: also from experience, suddenly wanting two of something where before there was only one, is not that uncommon.
As with any software engineering guideline, there are exceptions. E.g. Java-style loggers are so ubiqitous and "not that mutable", that it's generally good for them to be global.
Edit: also from experience, suddenly wanting two of something where before there was only one, is not that uncommon.