Global variables are variables that are accessible from all elements of a software component.
Global variables are variables that are accessible from all elements of a software component.
Global variables are used to share information between elements of a component and to store a part of the component's state. They therfore:
- create a hidden coupling between all the elements that use them;
- are a source of accidental bugs and inconsistencies, when changes and side-effects are not sufficiently controlled.