principle-foundational-thinking
基础思维
Structural decisions protect option value. Code-level decisions protect simplicity.
结构决策保护期权价值。代码级决策保护简单。
Data structures first. Get the data shape right before writing logic. Define core types early, trace every access pattern, and choose structures that match the dominant paths.
数据结构优先。 写逻辑前先把数据形状做对。早定核心类型,追踪每种访问模式,选匹配主导路径的结构。
At code level, DRY the structure, not every line. Types and data models should converge. Three similar statements still beat a premature abstraction. Prefer explicit over clever. Test behavior and edge cases, not line counts.
代码层面,DRY 结构,不是每一行。类型与数据模型应收敛。三句相似语句仍胜过过早抽象。宁显式勿取巧。测行为与边界,不测行数。
Concurrency corollary. Before sharing state between actors, ask “what happens if another actor modifies this concurrently?” If not “nothing”, isolate.
并发推论。 在 actor 间共享状态前,问「另一 actor 并发改它会怎样?」答案不是「没事」就隔离。
Scaffold first. If something helps every later phase, do it first. Ask “does every subsequent phase benefit from this existing?” CI, linting, test infrastructure, and shared types are scaffold. Sequence for option value: setup before features, tests before fixes. Keep commits small and single-purpose.
先脚手架。 对后续每阶段都有帮助的事,先做。问「后续每阶段都受益于它已存在吗?」CI、lint、测试基建、共享类型是脚手架。按期权价值排序:setup 先于功能,测试先于修复。commit 保持小而单一目的。
Each increment should land a coherent abstraction or deepen one that exists. Do not spread a new capability across callers as special-case coordination.
每次增量应落地一个连贯抽象,或加深已有抽象。别把新能力散成调用方的特判协调。
Subtraction comes before scaffolding. Remove dead code first, then lay foundations.
减法先于脚手架。先删死代码,再打基础。