Standing up for my bad code

2022-11-30 19:24

Today at work I had an interesting experience. I was pair programming with a few people (mob programming?) and while one participant was browsing through some code they commented on a particular line saying,: "I hate when people do this, it makes me so angry!".

I looked at the line. Sure enough, I had written it. Then I said, "I wrote that line."

I think at the beginning of my career I might have tried to justify myself, might have looked for an opportunity to prove a point or I would have silently sat there and felt embarrassed.

None of those things happened. I spoke calmly and simply stated a fact.

After that, the other parties who were present, understandably, did a bit of backpedalling to justify that it wasn't that bad. I did not say anything. I just sat and listened.

While I'm proud of this, there is something different I would like to do the next time I find myself in this situation 1; I would like to say something like this:

"I wrote that line of code. Would you be willing to share what you don't like about it? I'd appreciate the feedback."

It might not sound sincere, but it's true. I do want the feedback. and the other truth is — it might very well be a bad line of code. I'm not writing this post with specifics to prove I was right (or wrong) - but to try and say that I'm here and willing to learn. The person who made the original statement has a lot more experience than me—I won't lie to myself or bullshit my way into pretending that I have as much experience as them. Instead, I can see that even in this tiny moment, this person's desire to work with, read, and to write good code was not being met.

I'm proud of myself for recognizing an opportunity to make a choice on how to react. It took some time for me to get here, and I have a ways to go, but it's important to recognize these baby steps 2.

Thanks for reading, WT.

Footnotes

1

And it will happen again; it's part of the job.

2

I'm starting to sound like a shill for Non Violent Communication, but having read and listened to Marshall Rosenberg's talks have definitely helped me become more reslient and empathetic.