Developers, it is time to be dirty, old, and mediocre

LORY
3 min readJul 2, 2024

3 common mindsets I have seen (been) in the past 15 years of software development career

The Code is Dirty and My Hands are Clean!

When You Encounter:

  • A function that doesn’t work well.
  • A utility class that is difficult to use.
  • A daunting bug is assigned on your first day, making you uncomfortable debugging in a “s**t mountain” of code.

Don’t:

  • Rewrite the function from scratch.
  • Leave it as is, copy most of the code, modify it, and create a new one with the same functionality that fits your use case.
  • Refactor the ‘s**t mountain’ while fixing the bug, thinking you’ll find the bug in the process.

Do This Instead:

  • Add optional parameters for your use case or use polymorphism by subclassing to derive the desired behavior.
  • Write tests after making changes to ensure your modifications work as intended.
  • Modify the class to fulfill your use case with minimal changes.
  • Check existing logs to trace the issue. If there aren’t enough logs, add more trace points to aid in debugging.
  • Solve the issue with minimal changes.
  • Treat refactoring and bug fixing as separate processes; never combine them into one go.

--

--

LORY
LORY

Written by LORY

A channel which focusing on developer growth and self improvement

Responses (8)