Re:“Design Patterns” Aren't (2002)
by dwaite on Sunday March 07, 2021 @10:26PM
(#26382043)
Not quite - variables are references to objects, there's nothing that restricts global variables themselves to only reference a single _instance_ of an object.
That said, a global singleton (and global state in general) is usually an anti-pattern; having pretty much any code be able to depend on the state makes it very difficult to evaluate the impact of a change.
That said, a global singleton (and global state in general) is usually an anti-pattern; having pretty much any code be able to depend on the state makes it very difficult to evaluate the impact of a change.