Re-write is never an option in real life
Wed 21 Oct 2020

In software development we always see that there are a lot of developers who are re-writing and re-building. In my opinion, it's not a good thing to do. No matter the coding patterns or expectations from clients. They rarely pay for rebuilding something we've already have. 

  • Firstly, regarding to Open/Close principle we close for modifying.
  • Regarding to clients, they want development speed.
  • Regarding to developer, we have to do a lot what've already been done.
  • Taking risks of changing.

I'm not talking about a hug project but the tasks we do every single day. We see some messy code, we try to refactor as much as possible. It's cool when we do refactoring but not what we should do with big amount of code. We get stuck in refactoring and can not finish current task soon. Team Leader is waiting, Sales are waiting and Clients are waiting. 

What we should do?

  • Try to finish task with small amount of code and impact.
  • Do not touch the messy legacy code. Try to follow Open/Close principle. This principle is not with "good legacy code" condition. No matter the legacy code is good or not.
  • Isolating code:
    • legacy with new code.
    • messy code with clean code.
    • what change regularly with what remain in certain.
  • Small implementation, class, interface.

We have to find balance between building required features and refactoring the code. Blowing out the existing code and starting from scratch is not a solution. I don't think any Client would pay for that. Good developer is not about only writing good code but also dealing with messy code. As a developer we should learn the vision from architects. We put those things work together.