read the transcript!
It’s much easier to debug when your program does the exact same thing every time you run it.
Illustration of a sad stick figure with curly hair.
person (thinking): “the bug only happens 10% of the time, it’s SO HARD to figure out if my change fixed it or not.”
There are a bunch of tools for controlling your program’s inputs to reduce randomness, for example:
- many random number generators let you set the seed so you get the same results every time.
faketime fakes the current time.
- libraries like ruby’s
vcr can record http requests.
- record/replay debuggers like
rr record everything.