Yesterday I had to debug a programme written by a colleague. I realised that the majority of debugging is analysis. Understanding how the code works. As a result, I realised that the debugger was running backwards.
As someone working to work out why there is a problem with the output. Ideally I would like to start with the output and move backward through the execution of the code until I reach the point where the problem occured. The analysis of a bug is similar to analysis in Feature Injection.
For example, I want “A” as an output.
A = B + C
Therefore I need B and C.
B = D * C
C = E + F
D, E & F are all inputs to the system.
To help with analysis of a bug, the debugger should move backward through the execution of the code. I should be able to put a watch on output values and then the debugger should show me when the values are updated. If I start watching A, the debugger should ask me (automatically) show me B & C. When B is updated, it should show the values in D & C.
Currently the debugger runs forward in the direction of execution. As a result I have to search for variables, get to understand the code and all sorts of stuff to analyse where the problem is.
I haven’t done debugging of real code in years, err, cough, decades. When I used to do it we did not have debuggers and had to step through the code instead. It was impossible to work backwards using the the original manual process. However, this process has become automated and updated until we have the current “engine in front of the car because the horse was in front of the cart design”.
Am I missing something obvious or is it time to move the engine behind the car where it really should be.