Caffeinated Coder
Book an appointment
Lesson 30 · Designing code

Modules and interfaces

A big program is easier to read, test and change when it is split into modules: files that each do one job. Follow a small notes program in Python as main.py imports notes.py, uses only its public functions, and never sees its hidden helper. Then unplug a file store and plug a database store into the same Storage interface: two lines of main.py change, notes.py does not change at all, and the output stays the same.

10 min10 steps5 questionsBeginner
Fig 30 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.