Refactoring BS and its value

Oh boy, I was in a meeting with my CTO and jr. Engineering Manager. EM said we are refactoring 80% of the code we write every month. I was shocked by that sentence and repeated it first in my head then out loud.

“You are writing code to refactor them again?” I asked muttering while looking dead in the eye to both of them. This was not something to be shocked or embarrassed by for them I understood. I repeated: So, you are saying, 80% of the code we write today is being rewritten, which means we are only able to produce a 20% valuable output each month and the rest needs to be corrected?

This raised their eyebrows. I felt deep down that it was the first time someone challenged them this much and forced them to think how stupid it sounded the things they were saying.

Of course, things did not change and I did not stay in that company for so long. Rewriting 80% of the code you produce each month sounds crazy, but that company was and is not the only one.

I am not against refactoring. I believe over time things get old and need to be updated/upgraded. The question is how often we are supposed to be doing those updates.

Yes, tech is evolving really fast. The amount of frameworks available is soon going to reach the number of stars(!), new shiny thing is what we all want to have. But what about value creation? Does refactoring even add any value?

Yes and no. Just like everything in life, when done at the right time for the right purpose, yes, it is really valuable, otherwise, it is just a waste of time.

Then how do know when is the right time? Actually, pretty simple. As soon as you become aware of technical problems. Meaning, when you are aware of technical debt and where it stems from is the right time to think about possible refactoring to pay the debt.

But what about the debt we are creating while we are writing the code? Then don’t write the code! and do the refactoring even before beginning.

Write the code, refactor it, adapt all connectors, other methods, and so on. Not writing is even more productive.

Again, I am not against refactoring. Instead, I support it. But only it has merits and it is not for the sake of using a new fancy thing.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store