Accumulate and fire
Encyclopedia : A : AC : ACC : Accumulate and fire
"Accumulate and fire" is a programming style in which the program sets a number of global variables or objects, then invokes subprograms or methods which operate on the globally set values.
This is considered problematic because:
- it is not evident when reading the program which globals serve as arguments,
- programmers can forget to set a value before invoking,
- the state can change in a moment between setting and invoking, particularly when programming with threading,
- the global variables may be corrupted by being unintentionally used to pass values to more than one subroutine.
- it makes the use of recursion much more awkward.
Accumulate and fire is considered an example of an anti-pattern.
See also
- Functional programming for programming without side effects
- Side effect (computer science) for more problems
From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.
