Effective debugging is not just about removing defects, it includes the following steps
- Figure out why the software is running wrong
- Fix this problem
- Avoid breaking other parts
- Maintain or improve the overall quality of your code
- Make sure that the same problem doesn't happen elsewhere, and it won't happen again.
Build experiments, observe results
- Dependence on observation and experience rather than theory and pure logical reasoning
- Reading the source code, reasoning about the health of the software, usually inefficient and dangerous
- To carefully build an experimental environment and observe the health of the software
A few questions to be clarified
Do you know what's going on?
- Know exactly what's going on and what happens.
- Do not rely entirely on defect reports, and the bug report itself will not be less error
- If there is no defect report, it should be done after understanding the whole procedure.
One question at a time
- It is difficult to debug a flaw, so do not correct several at the same time, making the situation more complicated
- After the fix, each time you make a logical change, you check in once, if you have multiple modifications at one time, it is difficult to implement
- Sometimes you think that a defect is caused by a cause, which is actually caused by multiple reasons.
Check the simple stuff first.
- Many defects are caused by seeing your omissions, so don't overlook simple things.
- Developers should avoid the NIH (not invented here, I invented the disease) and think they have to do everything themselves, even if there is a good solution
- Ask other people on the team if they have encountered similar problems, can greatly reduce costs, save energy
< reading notes > The way to debug software: an Empirical approach