When teaching developers, I’ll often refer to “the ugliest, nastiest, part of your codebase that you’re all afraid to touch in case it breaks”. When I say that, everyone usually nods their heads. They know exactly what code I’m talking about because any long lived codebase has one. In fact they often even know who wrote that particular code, and its very common for that person to no longer be at the company.
This code makes for an excellent teaching point. If we work as an ensemble (often called mob programming), this is the perfect code to fix. At a minimum, we’ll learn something about a part of the code that has been worrying us for some time. At best, we’ll fix it and will have made a significant contribution.
What you may find surprising is that this part of the code that scares everyone, often isn’t even used anymore. It’s common for people to have avoided this code so effectively that nothing actually calls it anymore.
Many times we’ve been able to just throw this code away. Even when we can’t do that, we’re usually able to replace it with something considerably simpler and easier to understand.
This is code that no single developer wants to touch. It’s too fragile and/or risky to change so everyone stays away from it. When we work collaboratively, however, and bring the skills of the entire team to bear on it, it’s not that hard to fix.
There is real value in actual collaboration, rather than all working individually. We should do it more often.