I was talking with a friend of mine recently about an all too common problem in software development. That problem is finding the time and resources to revisit working, but not perfect code. For whatever your definition of " perfect" may be.
The developers feel this particular bit of code is just plain nasty. Maybe it is written in a confusing manner, poorly documented, or the landscape has changed so much that the entire architecture could use a rethink. The programmers may have thought up a better way, changed their style/best practices, or perhaps have just improved their skills since that code was written. But it works. It accomplishes the business goals.
Because it works, the management/marketing/sales folks are not very interested in making it better. They would rather the programmers focus their efforts on new features, because they don't feel they can sell code quality. " Maybe next month/year/release we can do that, but right now go knock out some of these TODO list items... ", is what you typically hear.
Both sides of this struggle need to realize that they both are correct and both incorrect. The developers are right in saying the code isn't perfect and could be improved. They are also wrong, because sometimes what you have is "good enough".
The biz folks are correct in their thinking that they can't directly sell the results of the programmer's effort. They can't put it on brochure and it certainly won't get them talked about in FastCompany. But they are also wrong, because they are missing the long term impact the code quality/design will have on their future business. It is difficult for them to understand how changing, for example to a messaging oriented architecture, helps their modularity and scalability. How it might drastically reduce future development time, improve testing, etc, etc, etc.
Arguing this out could take forever. Not to mention you will have to argue each architecture change as you find/want them.
A technique I have used with great success in the past is what I have so cleverly named "Friday Afternoons". Friday afternoons are probably the least productive part of an employee's week. They are watching the clock in anticipation of the weekend. It happens to everyone. Experienced sales people will tell you that it is basically impossible for them to get any real sales on Monday mornings and Friday afternoons.
As a compromise, I suggest management give the developers free reign to make architecture, design, and code clean up changes on Friday afternoons. You may need to implement rules around this, such as the changes can't impact any deadlines, they can't create any new work for others, can't impact the product in adverse ways from the customer's perspective, all work must be done in a cleanup branch, etc.
Some of you managers out there are probably thinking, but "No way, that's 10% of our development time". If you feel this way, you're really deluding yourself. No one is 100% productive, and I would estimate no one is even 25% productive on Friday afternoons, yourself included.
So why do this? There are several reasons:
- Developers can cleanup the code, effectively making their workplace ( aka the code ) more enjoyable. And everyone knows that Great Code comes from Happy Coders.
- The programmers feel their concerns are being heard. That management cares about about the quality and not just the dollar signs.
- You eliminate the time drain of the meetings arguing about these issues.
- The coders are self-motivated in their Friday afternoon sessions. You weren't going to get much out of them anyway, but at least there is a chance that you can reap future benefits from this work.
Maybe one of those architecture changes means that a requested new feature takes 2 days to implement rather than 2 weeks. Or perhaps the code will run 5% faster or scale 2x as well. Even if you just end up with better documentation and a slighly improved employee morale this is win.
If you end up using this technique for awhile, please send me an E-mail or leave a comment here. I would love to see how this idea plays out in different environments.