WebFund 2015W Lecture 17
Video
The video for the lecture given on March 11, 2015 is now available.
Notes
In Lecture
Debugging
---------
* making a program work
- "It *should* work, I did everything right"
- if you say this, slap yourself
- because you are wrong
- do *not* throw up your hands
* really debugging is about fixing mental models
* mental models are how we imagine things in the world are
* they are always wrong, but good ones are useful
* when your mental model diverges from your experience...
- "it's broken" (no it isn't)
- your mental model is broken
- first, fix mental model, *then* fix the problem
- alternative to flailing (trying random stuff until you get the result you want)
- don't flail
- *do* experiment
- difference between flailing and experimenting is hypotheses
- tricky to generate the right hypotheses
- you *shouldn't* generate hypotheses purely by searching
Steps for debugging
* observe problems (beware confirmation bias)
- pay attention to observations that contradict your mental model
(don't just pay attention to the confirming ones)
*look for outliers*
* generate hypotheses
- initially, "brainstorm" (i.e., be open to crazy ideas)
- don't just go with the first one that occurs to you
* explore hypotheses broadly
- do breadth-first search more than depth-first
- be aware that you can't trust any of your hypotheses
* don't trust the first hypothesis that seems to match
- treat it as tentative until you have significant additional evidence
- generate new hypotheses to try and break your candidate solution
- (fail fast)
* but move on once it is solved "well enough"
- know when to stop