W WolfCode · CSC 141
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

  1. 10.00 Worked Example
    Walkthrough: Distance (Incremental Build)
    例题: 距离 (增量构建)
    python-decomposition python-functions
    10 min
  2. 10.01 Exercise
    Hypotenuse
    斜边
    python-decomposition python-functions
    15 min
  3. 10.02 Exercise
    Area of Shapes
    多形状求面积
    python-decomposition python-functions
    20 min
  4. 10.03 Exercise
    Refactor Monolith
    拆分大函数
    python-decomposition python-functions
    25 min
  5. 10.04 Homework
    Homework: GPA Calculator
    作业: GPA 计算器
    python-decomposition python-functions
    40 min