methods of debugging
TRANSCRIPT
Methods of DebuggingRavikanth Andhavarapu
Mindset for Debugging
As soon as you encounter a bug you should focus on these two questions
1. Where is the source location of the bug?
2. What is happening?
Source Location of the Bug
1. Read the error message. This is the first clue for finding where the exact bug is. This may not be enough.
2. Start removing pieces of code and see if the bug disappears. Obviously some functionality also disappears as you do this.
This should be enough for you to figure out the exact source location of the bug.
Advantage of finding the source location first
1. Reduces your search area
2. Sometimes this may be so precise that you don't have to do go to the next step(figure out what is happening) to fix it.
Find out what is happening
You should know the methods of inspecting code for this.
Chrome developer tools for front end
Print out variables in the middle of the code
Set up debugger to interact with the code
Use REPL if it is available.