Staying sane while writing software
June 22, 2014September 16, 2016
This is a collection of principles, techniques, and paradigms that lead to useful, quality software while preserving the sanity of the programmers writing it. Mental health and project success go hand-in-hand.
Not all of the principles mentioned here can hold in all cases. Some may conflict in a particular setting. But where possible, applying these ideas seems to lead to the most satisfying results.
Currently this is just an outline.
Attributes of desirable software
What most people (should) want
- features!
- customization
- privacy
- security
- robustness
- performance
- responsiveness
- low resource consumption
What programmers also want
- repeatable behavior
- incremental effects
- local reasoning
- easy rearrangement
- generalization
- efficiency
- scalability
- consistency
Qualities that help satisfy these desires
Relatively abstract
- monotonicity
- accumulation described by sets or, more generally, lattices
- idempotence
- commutativity
- The Scalable Commutativity Rule
- "Whenever interface operations commute, they can be implemented in a way that scales."
- The Scalable Commutativity Rule
- associativity
- orthogonality
- composability
Somewhat more concrete
- principle of least authority
- declarative description
- redundancy
- tolerance
- isolation
Some techniques that can provide these properties
Broad concepts
- modular design
- decentralized authority
- distribution of resources, labor and responsibility
- granular delegation of authority
- as in the object-capability model
- clear, incorruptible sources of truth
More specific architectural choices
- purely functional cores with imperative shells
- shared global state without local state
- object capabilities
- as in the E Programming Language
- caching
- replication
- append-only databases
- consistent or rendezvous hashing
- SOA (in the microservices sense)
- smart endpoints, dumb pipes
- service failure resilience
- REST (in the hypermedia-driven sense)
- CRDTs
- Conflict-free Replicated Data Types
- Strong eventual consistency
- LVars
- CALM
- Consistency as logical monotonicity
- as in the Bloom programming language
- Relational Programming
- Programs that can be run in multiple directions
- as in the miniKanren EDSL
- Probabilistic Programming
- Programs that describe and perform inference in probabilistic models
- as used in Probabilistic Models of Cognition
- The MIT Probabilistic Computing Project