Hunting bugs
Debugging is about finding and resolving defects that prevent the intended application behavior. Here, what is crucial is to find the code causing the problem. What do we usually do when we encounter a bug? Let's say, we have a form that is assumed to run a validation on a submit event, but it doesn't. First of all, we have a number of assumptions to be met. For example, if the reference to the form element is valid, if the event and method name were spelled correctly during registering a listener, if the object context is not lost in the body of the listener, and so on.
Some bugs can be discovered automatically such as by validating input and output on the entry and exit points of methods (see Design by contract at: https://en.wikipedia.org/wiki/Design_by_contract). However, we have to spot other bugs manually, and here we can use two options. Starting from the point where the code is surely correct step by step to the problem point (bottom-up debugging), or on the contrary...