Knowledge
Search knowledge... ⌘K
Knowledge · Anti-Patterns
Smell Global Data
Code smell indicating the dangerous use of globally accessible mutable data
Tags
refactoring-fowlercode-qualitymaintainabilitycode-smell2nd
Impact
Global data is especially nasty because it can be modified from anywhere in the codebase, and there is no mechanism to discover which part of the code touched it. Bugs that arise from global data can be extremely difficult to track down. The most common form is global variables, but class variables and singletons present the same problems. The key is data that can be accessed from any part of the code.
Symptoms
- Global data is especially nasty because it can be modified from anywhere in the codebase, and there is no mechanism to discover which part of the code touched it. Bugs that arise from global data can be extremely difficult to track down. The most common form is global variables, but class variables and singletons present the same problems. The key is data that can be accessed from any part of the code.
Source
Martin Fowler — Refactoring: Improving the Design of Existing Code, 2nd