Your Moral Obligation to Future Coder
These thoughts were originally posted at http://ardentdev.com in 2010. I’ve moved them here in order to repurpose that domain for a software development podcast.
Think back to some nontrivial piece of code you wrote. Now mentally crumple it up into a ball, douse it with gasoline, and light that sucker on fire. That is what some future coder is going to want to do to your code.
(Take a moment to let it sink in that Future Coder might very well be Future You.)
OK, take a deep breath and exhale slowly. Future Coder can’t hurt you unless your code is still in use after someone invents time travel. And if Future Coder comes back to stop you from writing that code, Future Coder won’t have a job fixing your code in the future… (ah, the paradoxes of time travel).
Code has a past and a future. When you inherit code or parachute into a project, you must embrace the legacy of the code. Before you mentally skewer the coders who came before you, remember that you probably lack insight into the context in which previous coding decisions were made. It is, of course, quite possible that the programmer before you was a complete idiot. More likely, though, that programmer was working under some constraints that drove him/her toward the solution you now curse.
Although it is conceivable that you are the last ever maintainer of said code, you will likely pass on the responsibility to someone else eventually. You have a moral obligation to your fellow developers to leave behind something maintainable. Consistency and predictability in your code is a major part of maintainability. That means if 30 data entry forms use strongly typed DataSet objects but you prefer NHibernate, you write the 31st data entry form using a strongly typed DataSet. It is irresponsible to create Frankencode systems. Your personal whims do not trump your responsibility to your fellow developer.
Maintenance developers do not get enough credit. It is frustrating and often thankless work trying to wrap your brain around systems that have been tweaked by countless programmers to adapt to changing business needs.
The next time you curse someone else’s code, remember that somewhere out there another developer is cursing something you once coded.