Chapter 10
Decomposition
程序分解
How to write a 200-line program without going crazy. Incremental development (small steps, scaffolding, test as you go) + composition (assemble small functions into bigger ones). Strictly aligned with Think Python §3.11, §6.2, §6.3.
Strict source: Think Python §3.11, §6.2, §6.3
Lessons in this chapter
- 10.00 Worked ExampleWalkthrough: Distance (Incremental Build)例题: 距离 (增量构建)python-decomposition python-functions10 min
- 10.01 ExerciseHypotenuse斜边python-decomposition python-functions15 min
- 10.02 ExerciseArea of Shapes多形状求面积python-decomposition python-functions20 min
- 10.03 ExerciseRefactor Monolith拆分大函数python-decomposition python-functions25 min
- 10.04 HomeworkHomework: GPA Calculator作业: GPA 计算器python-decomposition python-functions40 min