While the most recent Coding Horror blog entry is not the first time I had heard of the concept, as I was reading it I couldn't help but apply the it in my mind to my own project.
The code base I'm working on is an ongoing project at about the 3 year mark now, and large portions of the code in the early stages of the project were written by developers who were sub par with little oversight which lead to a lot of code duplication, poor performance, etc. In discussions with management I've tried to make the case that there are several key components that are dying to be refactored and doing so would save a lot of time and headaches in future iterations when adding new features and fixing bugs in these key areas. While they seem to trust me that refactoring these components would be nice, they don't want to give me the leeway to do it. Note that I'm not talking about a rewrite of the entire code base or anything dramatic, just a rewrite of a few core areas that would take on the order of 2-3 weeks.
The questions then, is how to you as a developer sell to your manager that these areas need addressed and make a business case to get the time to address them now, rather than having to just incrementally improve here and there?
As a manager, I'm open to code refactoring/rewriting for one of three concrete business cases: reducing technical support, adding new functionality, and improving security.
As a developer, I see two additional "close by" cases where I'll refactor/pay down debt. You might find that your manager is open to these or he may just give you "that look" that tells you he doesn't quite buy it.
First, it sometimes makes sense to refactor simply to improve your ability to add new functionality. For example, if you can see business on the horizon that will require your system to be more flexible and adaptable, then you may need to rethink some of your original architecture's commitments. This is a great time to pay down debt.
Second, when new code is being written that is related to a component that already exists then it makes sense to pay down some debt. For example, if you were adding a new class that is logically a brother class of an existing one, then refactoring out common code into a parent class makes sense. As you do this, you have a great opportunity to pay down debt as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With