The transient nature of code

Full article

I just did one of the most painful things a dev can do to another dev. I deleted his code! I mean, it wasn't out of spite or anything, lol. (Could you imagine a team running around sabotaging each other by deleting their code?? That'd be nuts.)

No, it was good, solid code, covered by dozens of tests, which made it that much harder to pull the trigger. But it wasn't needed anymore. The team was sent new marching orders, and although at first I just commented it all out (in case our orders changed again, I told myself), it was ultimately relegated to the annals of git log. And he totally got why and supported it.. even if he was relieved I was pulling the trigger instead of him. 😏

Programming is a funny thing - any individual piece of code is quite ephemeral. Sometimes, someone comes up with a better way of doing a thing and you have to swallow your pride. Other times, priorities change and you find yourself pivoting (as in this case). But most of the time... it's just the passage of time.

The code you write today, like a brush stroke on a large canvas, changes the overall picture slightly (probably not as much as most of us would like to believe), but other brush strokes will eventually cover it up. The tough thing to come to terms with as part of a team, is that any individual contribution is only part of a larger goal. With a certain maturity comes a (somewhat painful) acceptance that nothing is safe from being moved around, not even the code you wrote last week.

On the flip side, we should all fight the urge to delete code for the sake of "doing it better". Wiping out someone's code shouldn't be the first thing you do, even though we've all been there. It takes time to understand why someone did what they did, and the next dev is just as likely to look at your rewrite and think the same exact thing.

You, me, that next dev - we're all the little guy in the blue hat... and we wrote the code he's whining about! It's missing a final pane where he realizes the project, mystifying as it seemed at first, actually has a goal - catch a mouse - and there's no need to rewrite or delete it.

Abstruse Goose

Author

Grant Winney

I write when I've got something to share - a personal project, a solution to a difficult problem, or just an idea. We learn by doing and sharing. We've all got something to contribute.


Comments / Reactions