Programming
Version control, tests, deploys: the product line
Not tools to learn — habits that decide whether what you built survives.
There is a clear line between "a script that worked on my machine once" and "a product". It is not talent. It is three habits, and each one buys you something specific.
1 · Version control buys you *the ability to experiment*. If any change can be undone in one command, you will try bolder things. If it cannot, you will only ever make timid edits.
2 · Tests buy you *the ability to change code you have forgotten*. A test is not there to prove you are right today; it is there so that in six months you can refactor without holding the whole system in your head.
3 · Reproducible deploy buys you *the ability to ship on a bad day*. If deploying requires a particular machine, a particular command history, or a person who remembers the steps, you have a single point of failure that will pick the worst possible moment.
# The whole discipline, in three commands
git add -A && git commit -m "why, not what" # a checkpoint you can return to
pytest -q # a machine that remembers your intent
# and a deploy that is one command, run from a clean checkout,
# needing no state that lives only in your head:
./deploy.sh # -> same result, any dayWhat do tests actually buy you?
Version control
Buys the freedom to experiment, because any change is reversible.
Test
A memory of intent — not proof of correctness.
Reproducible deploy
One command, clean checkout, no state in anyone's head.
Review cards
Version control
Buys the freedom to experiment, because any change is reversible.
Test
A memory of intent — not proof of correctness.
Reproducible deploy
One command, clean checkout, no state in anyone's head.
Sources for this lesson
Below are the references, editions and original links for further reading and checking.
BookPro Gitfree
Scott Chacon, Ben Straub
2nd edition(官方免费在线,含中文版)
版本控制的权威读物,官方维护,全文免费。
Docspytest documentationfree
pytest project
持续更新
测试框架的官方文档。测试的价值在于「记住你的意图」,而不是证明你今天写对了。
DocsThe Twelve-Factor Appfree
Adam Wiggins
持续维护
可复现部署的方法论基准。判断「能不能在状态差的那天也发版」用它对照最清楚。
Lights up these nodes in the hub:c-eng