20201230_notes

Debugging

Programming is writing out a set of instructions for an interpreter to follow such that following those instructions will lead to solving a computational challenge.

Two sides of a bug

  1. The cause: some line or lines where your code is written in a way that leads to problemns
  2. The symptoms: program state, output - An undesired program state or output that you expected to be different than what you see the computer producing. Could be a function manipulating data wrong or a variable holding unexpected values.

Different kinds of bugs

Goalposting

This is a variant on Divide and Conquer. When experiencing a bug, the first step is to set goal posts around the code that could possibly be a problem. From whichever direction you believe is most beneficial, test if an area is acting as expected using logging or a debugger or whatever. If it is, the goal post may be moved to that area, as we know it is doing what we expect. You should not move the goal post past anything you have not yet tested.

Last modified: 202107151447