I can’t solve this one, and I think I need your help. So, a developer was responding to a code review comment I made and they simply asked me, “why would I do that?” I gave my standard, dusty answer: “because you have to code defensively— you don’t know what the future holds.” But I suddenly realized… am I proliferating a fear of the future? How could I code fearfully when I run CubicleBuddha.com where I blog so often about living happily in the present? I’ll share the specific code example with you. I’m hoping to hear from the community whether my solution is “coding in the moment” or if I am actually bowing down to the fear.
We all have reasons for holding onto the past, like that Transformers lunchbox that I couldn’t handle throwing away. I loved it, but the truth is I was never going to use it again. But in the realm of professional software engineering, holding onto anything that isn’t being utilized can wreak havoc on a codebase through unintentional bugs and clutter that hurts maintainability and team moral. This unused code is called “dead code.” But how do we know when code is dead? And worse yet, how do we convince ourselves that it’s finally okay to let go of that lunchbox you’re not using anymore? The following tips will help you to get rid of the hoarding problem.