DEV Community

Discussion on: Debug or Refactor? The Coding Dilemma!

Collapse
 
klvenky profile image
Venkatesh KL

I would go at this with how complex the issue is & how the codebase is. If the issue that occurred is something that doesn't happen that often(may be once in a quarter) & requires less than a day(assume 4 focused hours), I'd be okay to debug it. If it doesn't, then let's see what we can do the best.
Are there unit tests covering all use cases & give great confidence?

  • Yes - go for a refactor.
  • No - Calculate the effort needed to write a good test suite vs excellent manual testing(consider testing the feature 10 times if it's manual QA). If the effort is worth it, then go for refactor. Otherwise, look for better alternatives.