Debugging Like a Boss: A Decade's Worth of Tips

Void⚡ - Jan 10 '23 - - Dev Community

Debugging code is harder than writing it

If you're a developer, chances are you've spent countless hours debugging code. Debugging can be time-consuming, frustrating and fun at the same time.

In my career as a developer, I've encountered my fair share of bugs. From minor issues to major production outages, I've tackled them all.

Here are my learnings in 25 lessons that will help you elevate your debugging game.

  1. Bugs are inevitable. You just get better at fixing them.

  2. Train your mind to see debugging as an opportunity to learn.

  3. Start with breaking down the problem. Obvious but overlooked.

  4. Understand what happened before trying to fix the bug.

  5. “But things are randomly failing” No, there’s always a reason. You just don’t know it yet.

  6. Assume nothing. Bugs can come from ANYWHERE.

  7. Identify “what’s wrong” before “where it’s wrong”.

  8. Investigate - When did the code work last? What has changed since then?

  9. Never skip reading the error message.

  10. Google it. Your issue is (most likely) faced by thousands everyday.

  11. When debugging code, never try to prove yourself right.

  12. Stop blaming JavaScript runtime. It’s your code that needs fixing.

  13. Debugging is hard if you do it without a plan.

  14. Explain your code out loud. Step by step. (Check Rubber-Duck-Debugging).

  15. When things stop making sense, start thinking on paper.

  16. Getting stuck is normal. It’s a signal to approach the problem differently.

  17. Ultimate debugging hack is taking a walk.

  18. Debugging tools are your best friend if you value your time.

  19. Fixing a bug with a friend or colleague is criminally underrated.

  20. Learn to ask for help on an issue. Give back by helping others.

  21. Bug in production? Revert breaking change rather than pushing a fix.

  22. Debugging a production system is an independent skill.

  23. Document your learnings and share them with the community.

  24. Debugging teaches you what you should know but don't.

  25. To improve debugging skills — fix more bugs. Cliche for a reason.

That's it!

Hope you found these lessons helpful.

If you liked this post, follow me for more of these 🙂
Also, would love to hear your best debugging tip in comments 👇

. . . . . . . . . . . . . . . . . . .