A moment in the code…

Today I wrote some code: five lines and some comments. One of our developers needed to do surgery on the paragraph-wrapping code in our text display engine. Every line of every book goes through this function on its way to the screen. Since I wrote it in 1993 it has grown to accommodate new features, languages, and technologies…and it’s a bit of a mess.
The fact that it’s a mess is why I don’t write code anymore. But since it hasn’t had to change for years, and since more than 7,000 books are known to work correctly with it, it has been left alone.
Today the developer needed to make a change to accommodate improved table support. He wisely asked me for insight before changing this important function. I took over the keyboard, tried to understand what I was thinking a decade ago, and then made the minor changes myself. And then I said to the developer, “I’m sorry you had to work with this.” He responded, “Are you apologizing for today, or for all the years since I took this code over?”
Ouch. But it still felt good to touch the code again.