DEV Community

ginger
ginger

Posted on

How to handle dead code and debugging

Here’s the situation I found myself in:

  • Co-worker finds a bug in a plug-in I made for work.
  • In the process of debugging, I found dead and flimsy code.
  • I found what was causing the bug
  • There is a small overlap between the bug and the dead code.

I would have to refactor at least part of the dead code to fix the bug.

But, assuming the bug is not super-critical, what order would you do this in?

Would you remove/refactor code to get a clean canvas, make sure everything still works, and then fix the bug?

Or fix the bug, then clean out the “bad” code?

Or a third option I didn’t think of, I’m interested to hear 😊

Top comments (0)