methods of debugging

5
Methods of Debugging Ravikanth Andhavarapu

Upload: ravikanth1988

Post on 18-Jan-2017

88 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Methods of Debugging

Methods of DebuggingRavikanth Andhavarapu

Page 2: Methods of Debugging

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?

Page 3: Methods of Debugging

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.

Page 4: Methods of Debugging

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.

Page 5: Methods of Debugging

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.