3 ms·
The absolute worst type of global mutable state I've had to deal with personally follows this antipattern: oldEnvironment = getGlobalEnvironment() Swit
by roywiggins 9y ago
The absolute worst type of global mutable state I've had to deal with personally follows this antipattern:
oldEnvironment = getGlobalEnvironment()
SwitchToGlobalEnvironment("Foo")
- Do things that rely on the "foo" globals
SwitchToGlobalEnvironment(oldEnvironment)
Or, worse, functions like this:
// NOTE: DO_STUFF assumes "FOO environment". Set FOO ENVIRONMENT before you call it.
def doStuff() {
- Do stuff that relies on foo environment
}
or:
// NOTE: depends on the value of global FooBar. Adjust FooBar to make DoStuff2 behave how you want
def doStuff2() { ... }
- ams6110 9y agoI suppose you never worked with old ASP or PHP apps where the first thing every page did was throw every form field value into the global Session object?
- MereInterest 9y agoI've worked with a library in which the file currently being read/written was maintained in global state. Not fun at all.