The guide for the novice debugger

table of contents

  • What is debugging?
  • Why do we have bugs?
  • Why debugging is hard?
  • Approaching a problem
  • Debugging strategies
  • Debugging Tips and tricks
  • How to fix a bug

Software developers spend 50% of their time debugging

Debugging is the process of finding and resolving defects or problems within the program that prevent correct operation of computer software or a system

what is debugging?

Debugging is simply a domain-specific term for problem solving

what is debugging?

We must stop interpret bugs as failures of individual programmers

what is debugging?

solving bugs is an important part of the learning process.

what is debugging?

Why do we have bugs in the first place?

Software errors result when

chains of cognitive breakdowns

are formed over the course of programming activity.

why do we have bugs?

most bugs are caused by the assumptions we didn't realize we were making

why do we have bugs?

What makes some developers better than others at debugging?

  • Experience

  • Good problem-solving skills

 

What makes good debuggers?

Fixed mindset vs Growth mindset

What makes good debuggers?

Why debugging is hard?

Debugging is a malleable skill, that becoming better at it requires you to work hard at the edge of your ability.

why debugging is hard?

If you don't fully understand a problem and then implement a "provably correct" solution based on incomplete understanding, debugging will still be required

why debugging is hard?

The hardest part of finding a solution is actually understanding the problem

 

Your goal is to determine precisely what is not working and define it

why debugging is hard?

A lot of things can go wrong 

  • Compiler/transpiler
  • Bundling
  • Transformations
  • Editor/IDE
  • extensions
  • Tests
  • Network
  • Virtual Machine
  • Browser
  • Language
  • Hardware
  • API

why debugging is hard?

Approaching a problem

Be persistent

Approaching a problem

Be curious

(be ready to learn new subjects)

Approaching a problem

Be ready to make some mess in the codebase

Approaching a problem

Always verify your assumptions

Approaching a problem

Make a progress by ruling out hypothesizes and isolate the problem

Approaching a problem

Take a break if needed

Approaching a problem

Don't be afraid of node_modules

Approaching a problem

There is no single algorithm that leads to the understanding of a problem, there are multiple strategies

Generate a hypothesis

debugging strategies

Follow the stack trace

debugging strategies

simplify/isolate the problem

debugging strategies

Google the error message

debugging strategies

The debugger should be your last resort

Use the debugger

Use the debugger

debugging strategies

Some debugging tips and tricks

Can be reproduced on a fresh clone + install?

(probably problem with dependencies)

debugging tips and tricks

Can be reproduced on a different machine

(probably problem with the environment)

debugging tips and tricks

Verify what exactly is causing the bug

 

1. Get to a place in history when everything was fine

2. Recreate the problem a single step.

debugging tips and tricks

How to fix a bug?

  1. Write a test that reproduces the problem and fails.

  2. Make it pass (by modifying production code)

If (needed && possible)

Thank you

Questions?

Made with Slides.com