DEV Community

Cover image for Debugging Like a Boss: A Decade's Worth of Tips
Void⚡
Void⚡

Posted on

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

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 👇

Top comments (6)

Collapse
 
marissab profile image
Marissa B • Edited

I'll add another: "Rebooting often fixes the symptom, not the problem."

We all know the age-old "just restart it" and voila - stuff magically starts working again! Super great and easy, right? No, you still have to go rummage around to find out what happened in the first place, then fix whatever it was so it can't happen again. Otherwise you'll be in reboot purgatory with kick-the-can solutions instead of a real fix.

This is why I have trust issues as a developer with a support background. "Just restart it" echoes in my sleep.

btw a good follow-up series would be explanations and examples of each thing you highlighted here. Just food for thought! Great list.

Collapse
 
nalawaderam1 profile image
Rameshwar Nalawade

Nice 👍👍👍

Collapse
 
codewithvoid profile image
Void⚡

Thanks for sharing Rameshwar :)

Collapse
 
codewithvoid profile image
Void⚡

Great add 👍

Glad you liked the list Marissa.

Collapse
 
codenameone profile image
Shai Almog

Nice list. I have a few more in my new debugging book that just dropped (sorry for the plug).

Collapse
 
codewithvoid profile image
Void⚡

Thanks for reading Shai!