think-model-first
思维模型:建模先于代码。写碰到状态与操作的代码之前,先把每个操作写成偏函数,写明它在哪些前置状态下有定义;再全化,定义域之外的每一格给一个确定的答复,不变式排除的格写不可达;最后翻成领域模型与对象模型再写代码,每个类型能指回模型。设计或实现会话、任务、连接、资源这类有生灭的对象,加一个操作或一个状态,或实现里出现「不该发生」的分支时加载;人说「先建模」「全化一下」「状态表呢」,或点名 /think-model-first 时也加载。不碰状态的纯计算与纯文档改动不加载。
Pinned to revision 95def4043198, so it is the text this page describes rather than whatever the author pushed since.
Files
- skills/think-model-first/SKILL.md
- skills/think-model-first/how-deep.md
- skills/think-model-first/partial-and-total.md
- skills/think-model-first/translate.md
Every link opens the file at its source, pinned to the revision this page describes.