The Full Wiki



More info on Accumulate and fire

Accumulate and fire: Wikis


Note: Many of our articles have direct quotes from sources you can cite, within the Wikipedia article! This article doesn't yet, but we're working on it! See more info or our list of citable articles.
"Accumulate and fire" is a programming style in which the program sets a number of global variables or object, then invokes subroutines 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.


  • Some older programming languages make this style hard to avoid: this is the only way of passing arguments to a subroutine in many BASIC dialects (using GOSUB) or to a paragraph in COBOL.

    Accumulate and fire is considered an example of an anti-pattern.

    See also

  • Functional programming for programming without side effects
  • Side effect for more problems












  • Got something to say? Make a comment.
    Your name
    Your email address
    Message
    Please enter the solution to case below
    12+8=