Ask HN: My tech lead keeps re writing my code. What do I do?

2 points by klunger ↗ HN
He doesn't comment on it in PRs, or only makes minor comments. He lets things get approved by other people and then goes back and quietly rewrites it later and has his buddy approve it. Sure, my code could use some improvement occasionally. But it isn't that bad and he could just comment on it when I do a PR. He does not do this to anyone else.

I don't want this to be about the fact that I am a minority in tech and the only one on the team. But, I am pretty sure it is. My career has been blissfully absent of these kinds of issues thus far and I have no idea how to handle it.

16 comments

[ 2.6 ms ] story [ 400 ms ] thread
What do you want to do?
I want him to stop doing it and treat me like the other members of the team. So, I guess I want advice on how to make that happen, if it's even possible.
So you know what you want him to do, and you are asking for advice to get that to happen. So I imagine that you want to learn how to stop your team lead changing the code you contributed after you contributed? Or do you want to do something else?

It helps to literally write out your own desires and wants of things that you can do yourself (versus other people doing) when it comes to these types of situations.

For example in a similar situation I might say "I want to make a case to my manager that the team lead isn't treating me fairly" or I might say "I want to be less anxious at work" or I might say "I want to find reasons not to leave my job" or I might say "I just want to do my job with no problems or issues" or I might say "I want to learn how to approach my team lead with this problem" or possibly (and this is something I've done) "I want to feel better venting to others"

Yep. If he has issues with it, fine. If he does though, I want him to bring this up during the code review process rather than passive-aggressively re-writing it after the fact.
> rather than passive-aggressively re-writing it after the fact.

At this point I would start questioning you instead:

- first: have you taken the time to read up on what passive aggressive means and how it usually plays out? IMO it is used way to often, just like micro-agressions etc.

- then: why are you so sure that he is not trying to help you?

- why would a tech lead do this silently if not to shield you?

I've written most of this elsewhere and you haven't even commented on it.

I say now is a good time to you to stop and think really carefully about the situation.

His way to handle it might not be perfect, but you might be about to bite someone who's trying to help you.

Don't do that.

I'd expect that his thinking on reading the PR is that this code is OK, but could be improved by doing such-and-such, I'll do that later. i.e., he doesn't see it as rewriting but just as incremental improvement (and as such would be out-of-place as a PR comment). Ask him if he could put those ideas into PRs, as a learning opportunity for you.
See my comment above, you know him better than me, but if I really wanted it to stop I'd ask politely one day, assuming good intentions (see my top level comment) why he does it.

Something along the lines of: "I've noticed that you've rewritten my code a number of times and got <buddy> to approve it, and I really haven't been able to figure out why."

If so, be prepared, some people can be a bit either on or off I guess.

Talk to the team lead and ask for feedback. So far you have only your internal impressions and thoughts and they are worth nothing.
I've both had my code savagely re-written, and savagely re-wrote a lesser's code. Every good programmer is something of a control freak, and for good reason. Nature of the beast I'm afraid. "Don't hate, appreciate" applies here.
I would argue that there are boundaries to this sort of behaviour though.

There should be open discussion about these things.

Passive aggressive behaviour, which sounds very unprofessional.

If his manager is enabling or ignoring this behaviour, I would wager there is some toxic culture in action here.

Having said that, you should have a manager that you can give and get feedack to and from. Be open to criticism but also note any behaviour you feel is unfair or unbalanced.

If it looks like noone cares to openly discuss this behaviour I would start looking for a new job.

> and then goes back and quietly rewrites it later and has his buddy approve it.

Emphasis mine. I think "quietly" is the key:

He quietly rewrites it and quietly gets his buddy to accept it.

My guess is he scared away a new hire recently by some comment on their PR and is doing his best to avoid doing that mistake again.

Again, quietly is key here.

I've dealt with some people I'd consider brilliant a$$holes and this - as far as I can read - is quite far from it.

(I'm not judging on if it is a good or a bad idea, only that I'd surely take it as a sign that he wants you to stay and want to avoid embarrassing you.)

Edit:

Re-reading it this caught my eye:

> I don't want this to be about the fact that I am a minority in tech

This makes me even more sure about my conclusion. He wants you to stay and is afraid that you'll leave if he is too direct.

Incidentally, it's mildly preferable to have one's code surreptitiously re-written than to be needled in code review purgatory. The organization as a whole moves forward with the least amount of verbal back-and-forth, and you still bump up your commit count. Learn from it, and when you get good enough to re-write others' code, try to be more mentorly.
> I don't want this to be about the fact that I am a minority in tech and the only one on the team. But, I am pretty sure it is

No, it's not.

Be an adult and demand that your manager provide a thorough explanation on why he is rewriting your code. If your code is shit, then make him tell you so you can improve.

>No, it's not.

There is absolutely no way you could know that. However, it speaks volumes about your character that you would declare it so confidently.

After reading a lot of the feedback here, I spoke to my tech lead.

He admitted that he had been significantly harder on me than others because I was less experienced. He trusted it less and it was easier for him to just rewrite than bother with actually doing a proper code review. Not because my code was "shit".

I came with receipts. He admitted this was deeply unfair and unprofessional agreed to start doing proper code reviews.

Thanks for the feedback, everyone.