Lite / Building Machines That Respond / Week 8
Week 8: Debugging
This week you will
- Read a traceback from the bottom up and locate the line and kind of error.
- Use a reproduce–hypothesise–test method with print probes to find a logic bug.
- Validate input with try / except and plausibility checks, counting what is rejected.
Lessons
- Read the traceback · about 30 min
Your program crashes with six lines of red text. Most people read the top. Why does the answer start at the bottom? - Reproduce, hypothesise, test: hunting logic bugs · about 40 min
A robot's speed log says 240 m/s. Nothing crashed. Where do you even start? - Catch bad data before it bites · about 40 min
A data logger writes ERR whenever its sensor hiccups. Should your program crash, skip the line, or quietly count it as zero?