
A book by @ztellman about the philosophy of software, through the lens of Clojure
Joined July 2018
- Tweets275
- Following1
- Followers924
- Likes12
The tick's model of its environment cannot guarantee a consistent outcome. For any given values of heat and sweat, there are scenarios that lead to success and scenarios that lead to failure. Nevertheless, the tick survives; its simplistic model satisfices.
4
Self-consistency is necessary, but not sufficient. When evaluating software, we cannot ignore the broader context. We must take advantage of every available perspective. We must be dissatisfied with easy answers. We must be curious.
4
There are countless resources for creating self-consistent abstractions, but few for creating useful abstractions. This is in part because self-consistency is an objective property, while utility is hopelessly subjective.
In software, we don't have the luxury of ignoring context. We need our models to be self-consistent, but we also need them to be *useful* within our given environment.
6
Hoare's abstraction function, like the Church numeral, is a mathematical abstraction. It describes a model which has provable qualities and is often described as "correct," which means it is self-consistent. By omission, it deems the context unimportant.
2
But the cons cell is not timeless; since its invention in the late 1950s, computers have changed. Notably, processor speed has improved more than memory latency, and so the relative cost of following a reference has grown over time.
4
For a table to be useful, it must avoid conflicts. One way to accomplish this is to keep the table private so it reflects only our vision of how keys map onto behavior. Alternatively, we can extend the table using only private keys so no one else can shadow our behavior.
2
A reference *conveys* values, and a conditional *decides* based upon values. These are complementary primitives and are present in every modern language. Through their composition, we can create software of arbitrary complexity.
2
A name is a lexical reference that is dereferenced at compile time. A pointer is a memory reference that is dereferenced at runtime.
4
Indirection provides separation between *what* and *how*. It exists wherever "how does this work?" is best answered, "it depends."
The `nil` value is one of the trickiest parts of Clojure, because it represents an absence. The absence of what, exactly, depends on the context.
1
7
Clojure makes it possible to ignore the differences between data structures, but that doesn't mean we should. Often, these differences matter.
1
So while Clojure's STM offers better throughput in extreme scenarios, it rarely offers a practical improvement. Atoms are simpler and introduce less overhead. In typical situations with little or no contention, atoms are faster.
4
Idioms provide a mapping between code structure and intent. Consistently used, they allow readers to trust their own intuition.
3
Each new layer, if it represents meaningful indirection, should reveal something new. Yet the lessons learned along the way should remain valid; an unfamiliar implementation should represent an unfamiliar idea, not just pointless variation on something we already understand.
6
Software is understood layer by layer. At each layer, readers will guess at the underlying intent. As they descend, they'll sometimes be proven wrong. Once they stop, they'll have only their intuition, and any counterexamples found along the way, to suggest what lies beneath.
9
In different parts of your code, the size and makeup of the audience will vary. The audience will also change over time; success with an expert audience will inevitably attract less-expert readers.
4
Narrowness and consistency are often in tension. Finding balance requires understanding your audience.
3