Files
nexus/wiki/concepts/MentalModel.md
2026-05-03 05:42:12 +08:00

39 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "MentalModel"
type: concept
tags: []
last_updated: 2026-05-02
---
## Definition
Mental Model心智模型是开发者对代码库结构、工作原理和边界的内在理解。准确的代码库心智模型能够支持开发者快速定位问题、预测变更影响、进行有效的代码审查。
## Building a Codebase Mental Model
### Three-Tier Explanation Structure
1. **One-line statement** — 一句话描述代码库是什么
2. **Five-minute overview** — 五分钟高层解释:任务、输入、输出、关键文件、主代码路径
3. **Deep dive** — 深度分析:类型、运行时、入口点、结构表、关键边界、详细代码流
### Key Components
- **Top-level structure**: 目录结构和职责划分
- **Entry points**: 启动文件、路由、配置
- **Data flow**: 输入如何流转、处理、输出
- **Key boundaries**: 展示层 / 应用层 / 持久层的边界
- **Ownership map**: 每个文件/模块负责什么
## Metrics for Good Mental Model
- 新开发者 5 分钟内能识别主入口点
- 能正确预测代码变更的影响范围
- 能准确描述跨模块的数据流
## Related Concepts
- [[CodebaseOnboarding]] — 代码库 onboarding 方法论
- [[ExecutionTracing]] — 执行路径追踪
- [[EvidenceFirstReasoning]] — 证据优先推理