Referential Transparency (computer Science)
Referential transparency and referential opacity are properties of parts of computer programs. An expression is said to be referentially transparent if it can be replaced with its value without changing the behavior of a program (in other words, yielding a program that has the same effects and output on the same input). The opposite term is referential opaqueness.
While in mathematics all function applications are referentially transparent, in programming this is not always the case. The importance of referential transparency is that it allows the programmer and the compiler to reason about program behavior. This can help in proving correctness, simplifying an algorithm, assisting in modifying code without breaking it, or optimizing code by means of memoization, common subexpression elimination or parallelization.
Referential transparency is one of the principles of functional programming; only referentially transparent functions can be memoized (transformed into equivalent functions which cache results). Some programming languages provide means to guarantee referential transparency. Some functional programming languages enforce referential transparency for all functions.
As referential transparency requires the same results for a given set of inputs at any point in time, a referentially transparent expression is therefore deterministic.
Read more about Referential Transparency (computer Science): Examples and Counterexamples, Contrast To Imperative Programming, Another Example
Famous quotes containing the word transparency:
“End of tomorrow.
Dont try to start the car or look deeper
Into the eternal wimpling of the sky: luster
On luster, transparency floated onto the topmost layer
Until the whole thing overflows like a silver
Wedding cake or Christmas tree, in a cascade of tears.”
—John Ashbery (b. 1927)