Making your JavaScript Pure by Jack Franklin

In notebook:
Article Notes
Created at:
2016-06-07
Updated:
2016-06-07
Tags:
JavaScript Functional Programming Fundamentals
Making your JavaScript Pure · An A List Apart Article
“Pure functions,” “side effects,” and “referential transparency”

Pure function

Only uses the variables that has been explicitly passed to it. Does not go out and grab some data from somewhere else (like the DOM)

Side Effects

Modifying data that is not inside its own scope.

Referential transparency

Given the same inputs the output is always the same
Adhering to the rules makes code more bug-free, maintainable, and testable.

Note: I see it as another argument why module-facade-mediator is a great pattern.