1. It isn’t critical code
2. Time is of the essence, “We need to ship now!”
3. There is high degree of confidence that it be visited again after we ship and be fixed up.
4. Surely, this code will not last that long.
I’m sure there are other good reasons to “git ‘er done!” and get things working, but more often than not, what isn’t critical code, becomes critical. What was going to be revisited and re-factored, now works, and in priority queues of life, “if it ain’t broke, why fix it?” Lastly, rarely does one “come this way again” just to tidy up. The moments spent in front of a block of code are more fleeting than you think.
This may not be news to developers more experienced than I, but as much as I hate to admit it, what was once temporary, almost always becomes permanent. There will come someone this way again, but not to tidy up, more often than not, they come to build upon your work and in the best of object oriented abstraction, your implementation and all it’s bandages, bailing wire and duct tape often remain hidden. Hidden that is, until they break in catastrophe.
All this reminded me of a poem I recently heard by Will Allen Dromgoole:
The Bridge Builder
An old man, going a lone highway,
Came, at the evening, cold and gray,
To a chasm, vast, and deep, and wide,
Through which was flowing a sullen tide.
The old man crossed in the twilight dim;
The sullen stream had no fears for him;
But he turned, when safe on the other side,
And built a bridge to span the tide.
“Old man,” said a fellow pilgrim, near,
“You are wasting strength with building here;
Your journey will end with the ending day;
You never again must pass this way;
You have crossed the chasm, deep and wide-
Why build you a bridge at the eventide?”
The builder lifted his old gray head:
“Good friend, in the path I have come,” he said,
“There followeth after me today,
A youth, whose feet must pass this way.
This chasm, that has been naught to me,
To that fair-haired youth may a pitfall be.
He, too, must cross in the twilight dim;
Good friend, I am building the bridge for him.”
When you write code, consider what it might look like to a new hire 10 years from now. Make it something that can be built upon, because whether your like it or not, it will have a long, long life.
Note 1: The same could probably be said for UI design as well, but that’s probably worth another post entirely.
Note 2: The picture above is of the the Eads Bridge built in 1874 is the oldest bridge over the Mississippi River, and the world’s first steel arch bridge.