A Big Payoff with Refactoring Code

Steven Bui
6 min readDec 2, 2018

When I became the tech lead, I inherited a product code base that was over a decade old, which also meant I inherited over a decade worth of technical debt and “spaghetti” code. I oversaw and helped on numerous projects to pay off tech debt but one project that stood out among the others. This project removed close to 8,000 lines of duplicated code and made it much more efficient to write code in this particular area.

TL;DR: Clean code, refactoring, and paying off technical debt are essential for software development. Don’t accumulate a decade of tech debt!

Scenario

It all started with a bug report about a strange behavior that happened on one OS (operating system) platform but wasn’t present on another OS platform. Intuitively, the C++ code should have been designed to function the same way regardless of what OS it ran on. While diving deeper into the problem with a senior engineer, we discovered there was a bug fix that had already fixed the problem. However, the bug fix wasn’t copied over to the other platform. While I was explaining that these source files are duplicated many times and contained code that is similar to each other, my senior engineer suggested that it should be refactored to remove the duplication. A light bulb lit up at that moment. My senior engineer and I started planning out how to refactor this…

--

--

Steven Bui

👨‍💻 Software Developer 👨‍🏫 Engineering Leader 🕵️‍♂️ Problem Solver