Hacker News new | ask | show | jobs
by BinaryIdiot 2349 days ago
> I also think that a salaried engineer who thinks that a piece of code he or she (but almost always he) wrote is "his" or "hers" is totally wrong. It's the company's code.

While this is _technically correct_, this isn't how humans work. Humans attach their worth to things they do, even when they shouldn't. It's a difficult thing to avoid to most people so if you write some code, commit it and then later see a teammate completely rewriting it, it can come off as either:

1. You spent a lot of time and hard work on code that you kinda identify with (I mean, it's code you wrote. It's your "art") and then someone comes in and re-writes it without even asking you about it can make it feel that they think you're an idiot.

or maybe even worse

2. They didn't know the reason you wrote it that way (maybe it was in support of future changes?) and now they just screwed it all up.

Maybe you haven't run into either of those situations. If you haven't, great! I spent the first part of my career hitting the first one because of how hard it can be to disassociate with the work you produce and the second one I see happening occasionally. It's a breakdown in communication within a team.

4 comments

That’s the behavior of a junior engineer though. It’s a sign of an inferiority complex where any change feels like some kind of judgement on your ability to write it “correctly” the first time.

You are not your code, the code you wrote is not representative of you. Nobody who rewrites your code thinks that either.

You’re on a team working to build something larger than yourself. You’re not a bunch of painters sitting with your own easels in a room hoping to tape all of your paintings together in the end.

The best engineering teams I’ve ever worked on were groups of people that had no issues at all modifying each other’s code because we all trusted each other to do the right thing. The worst were the ones where each module had one “owner” who handled all of the changes to their module and “nobody else’s”.

This is how some humans work. No one on my current team has ever expressed disatisfaction when their code gets changed.
Same here. And my own code is rewritten frequently as business needs change or better factorings are discovered when we hit the rule of 3, as mentioned in this thread.

It's nothing personal; we all get paid and go home. There's a lot of bruised egos in this thread that would be better spent in therapy, I think.

The fix for this is to have a review system in place; you can then catch blatant code repetition before it goes in, and try to use your soft skills to guide the author toward a different solution such that they think it was their idea all along.
If you're the one who has created it and who touches that part of code more often than others then there is a notion of ownership: you don't want to accept changes that will get it into dead end and slow you down. That's how code review emerges. It's the same as the pull request system in the opensource development.