DEV Community

Discussion on: Debugging - you’re doing it wrong. 10 techniques to find a bug in your code

Collapse
 
ssimontis profile image
Scott Simontis

I was taught as an eager Electrical Engineer that there are two rules to fixing any problem.

1) Start from a known good: You need to be certain you are using components you can trust. Start from code (or hardware) that you can prove is working properly. If HW or SW is in an unknown state, you cannot reason about it.

2) Divide the problem in half: What would it take for you to get rid of half of the test cases or possible inputs? Can you isolate a module and remove dependencies so that you don't have to worry about the interaction of components, but only the functionality of a single system?

This combo has never failed me.

Collapse
 
monfernape profile image
Usman Khalil

Cool and makes great sense. I'm mechanical engineer myself and love when paths cross