Side effect (computer science)



         


In computer science, a side-effect is a property of a programming language function that it modifies some state other than its return value. For example, a function might modify a global or "static" variable, modify one of its arguments, write data to a display or file, or read some data from other side-effecting functions. Side-effects often make a program's behavior more difficult to understand.

Imperative programming is known for employing side effect to make programs function. Functional programming in turn is known for its minimization of side effects.

[Top]

Terminology

A function that uses side-effects is referred to as referentially opaque, and one that doesn't is called referentially transparent. For simplicity's sake, we say that a referentially transparent function is one that, given the same parameters, will always return the same result. Another term for a referentially transparent function is a optimization.





  View Live Article   This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License