DEV Community

Lorraine Moyo
Lorraine Moyo

Posted on

Should I refractor?

When dealing with spaghetti code at work, you generally have two primary options: refactoring the code or trying to understand and maintain it as is. Here's a breakdown of the pros and cons of each approach:

Option 1: Refactoring the Code
Pros:

  • Improved Code Quality

  • Easier to maintain in the future

  • Increased stability

Cons:

  • Time-consuming

  • Risk of introducing new bugs**

  • Possible downtime

  • Requires deep service knowledge

Option 2: Understanding and Maintaining the Existing Code
Pros:

  • Service continuity

  • Preservation of legacy logic

  • Good for short term

Cons

  • Maintaining the service is a headache

  • Decreased developer morale

  • Underlying issues increase

What do you guys do when faced with a new service that will potentially be your baby to take care of?

Top comments (0)