The only thing wrong with mutable state is that it is not isolated.
Mutable state is not the problem, isolation is the problem.
OOP-style encapsulation is not enough.
UNIX Live Free and Die
UNIX-like processes that die and are automagically cleaned up are another way to get isolation.
Even lowly C programs running under UNIX are isolated.
Leaking state should not be allowed.
Leaking depedencies should not be allowed.
I define non-local as:
Non-locality is: more than an eye-full.
Imagine if all code was only 5 lines long.
Imagine if all code was only one window long.
Imagine if all code was only one screen long.
Imagine if all code fit on one piece of paper (i.e. a printed page).
For example, 26 global variables, named A-Z, are more than I need for only 5 lines of code.
The Unit of Understandability
Problem: How To Keep Software Units Small?
The problem becomes: how do we keep all software units down to 7±2 lines in length?
I favor hierarchy.
Hierarchical return values.
Hierarchical sub-systems (e.g. a system can be more than 7±2 lines of code, as long as any sub-unit of code - isolated code - is only 7±2 lines long).
Flat-anything is bad.
Non-fractal anything is bad.
Trees are hierarchical.
Graphs and DAGs
Graphs and DAGs are not purely hierarchical, since they allow cross-talk between nodes.
Libraries of Code
Libraries create dependencies.
Avoid libraries. (!)
Avoid creating and using libraries as we understand them at present.
Stolen from a license-plate I saw in a UNIX lab. “UNIX Live Free or Die”. ↩