#100DaysOfCode: Python Day 13

Debugging

Subscribe to my newsletter and never miss my upcoming articles

#100DaysOfCode Day 13

Have you noticed that bugs enjoy waiting till Friday to be found? img.gif

Yesterday I explored how to squash them!

###The 10 Step Approach:

  1. Describe the problem: Doing this can help you break down the problem.
  2. Reproduce the bug: You have to get the bug repeatedly, or something more complicated may be the issue.
  3. Play computer: Think like a computer. Execute the code in your head and determine each lines outputs.
  4. Fix the errors: If your editor is underlining things in red underlined, fix that first.
  5. Print is your friend: Print values to see how they change during execution.
  6. Use a debugger: If your IDE supports it, make use of breakpoints.
  7. Take a break: Sometimes taking a break does wonders; make some coffee or have a nap and get back to the problem at hand.
  8. Ask a friend: Chances are your friend will see the problem from a different angle and help you identify the bug.
  9. Run often: Run/build your code often as you would want to pick up bugs sooner rather than later. Just imagine finding 20 bugs after writing 100 lines of code 🙈.
  10. Ask Stackoverflow: Always search for your problem on google before you resort to this, but chances are someone in the world will be able to help you or may have encountered that same rare bug you see.

These are things that I practice daily as a professional software developer, and I can comfortably say that they can be applied to almost all programming languages.

Want to stay up to date with my learning journey? Just head to my home page and sign up for my newsletter.

No Comments Yet