I'm five years into my programming career and I think I'm hot shit, I know how things should be done, I've read books, I've done courses, I know how things should absolutely not look too. I am the bee's knees. I'm team lead of a small team, I've been a developer on this suite of apps for the whole 5 years, I have all the knowledge.
Some code comes in for review from one of the other less experienced devs. I check through it and there's a lot of red flags. Tons of code that's obviously very similar, some serious refactoring is needed, a bunch of things need to be designed better and split into utility methods to prevent this copy paste code proliferating. It occurs to me this is a teachable moment so I write up a two page missive on how to refactor this stuff, why we don't write code like this, how we should aim to write it, why the perfect code is reusable and (gently) why this code is bullshit. I email it around to the team. I schedule a meeting to go over it.
About half an hour after sending this email and scheduling the meeting, the junior dev PMs me. "Here" she points out "is where my code is..." and aside from some small things it's totally free of all the red flags I brought up. "And here is the code it was building on" showing me the horror show code I'd written the missive about... and she very delicately leaves her screenshare on and hovers the mouse over the original commiters name saying nothing about it. That name is my name.
I have just spent the best part of an hour criticising past me's code, and then publicised it to all these people who I moments ago thought I was better than. It occurs to me at this point that I'm an arrogant shit. I'm not better. I'm just a few years further down the road. And the lady whose code I reviewed has a million times more emotional intelligence than me for the way she handled it so gracefully.
So yes, past me is an idiot, and here it's shown twice, five years apart.
What we can all hope is to learn not just to be a better developer from our past mistakes, but to learn be a better person when we realise we've fucked up too.
60
u/mierneuker Sep 23 '22
Let me tell you a story.
I'm five years into my programming career and I think I'm hot shit, I know how things should be done, I've read books, I've done courses, I know how things should absolutely not look too. I am the bee's knees. I'm team lead of a small team, I've been a developer on this suite of apps for the whole 5 years, I have all the knowledge.
Some code comes in for review from one of the other less experienced devs. I check through it and there's a lot of red flags. Tons of code that's obviously very similar, some serious refactoring is needed, a bunch of things need to be designed better and split into utility methods to prevent this copy paste code proliferating. It occurs to me this is a teachable moment so I write up a two page missive on how to refactor this stuff, why we don't write code like this, how we should aim to write it, why the perfect code is reusable and (gently) why this code is bullshit. I email it around to the team. I schedule a meeting to go over it.
About half an hour after sending this email and scheduling the meeting, the junior dev PMs me. "Here" she points out "is where my code is..." and aside from some small things it's totally free of all the red flags I brought up. "And here is the code it was building on" showing me the horror show code I'd written the missive about... and she very delicately leaves her screenshare on and hovers the mouse over the original commiters name saying nothing about it. That name is my name.
I have just spent the best part of an hour criticising past me's code, and then publicised it to all these people who I moments ago thought I was better than. It occurs to me at this point that I'm an arrogant shit. I'm not better. I'm just a few years further down the road. And the lady whose code I reviewed has a million times more emotional intelligence than me for the way she handled it so gracefully.
So yes, past me is an idiot, and here it's shown twice, five years apart.
What we can all hope is to learn not just to be a better developer from our past mistakes, but to learn be a better person when we realise we've fucked up too.