DEV Community

Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard

Posted on • Updated on

Do you sometimes feel defensive during a PR review?

I know we shouldn't feel defensive.
But we do, don't we?

Oldest comments (26)

Collapse
 
nlxdodge profile image
NLxDoDge

Because it feels like your baby, the thing you have created is now being altered.

But to say it better, code changes all the time, next week the intern might have removed the code because the function specification was changed or whatever so just don't get to attached to your own code.

Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard • Edited

It's our baby and we are encouraged to code with a perfectionnist mindset, have strong opinions on how to do it right, produce clean code, respect all good practices, remove that newline would offend our sense of beauty, ...

And then we submit a pull request and suddenly we need to be like an ego-less buddhist monk that see things with a beginner mind and welcome challenges from everyone.

It's a tough dance to master :P

Collapse
 
theaccordance profile image
Joe Mainwaring

Two things to keep in mind when you're feeling defensive:

  1. Collaboration can be tricky since we're all unique individuals with unique personalities
  2. The nature of some PRs (ex: Architecture) require the solution to be challenged as the rest of the team will have to build upon the foundation the PR lays down.
Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard

I like your second point, there are indeed nature PR of different natures and if we recognize that, we can explicitly invite people to challenge us hard for PR that will have lots of repercussion down the line, but not do it for all PRs which would be wasteful

Collapse
 
jankapunkt profile image
Jan KΓΌster

Depends on the reviewer's style of communication. If it's clear that the reviewer's intention is to help me mold a bulletproof piece of awesomeness then their review SHOULD always be as detailed as possible and should not hesitate of using the hardest criticism as possible.

However if it sounds as their intentions is simply to disregard my implementation, because it doesn't fit their taste then I may get defensive.

In the end it's all written and missing nuances of the spoken word, so both sides need to be careful with interpretations.

Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard

I agree.

When I have the feeling that written discussion is leading us nowhere very slowly, I jump to a slack call and share my screen. It usually helps a lot.

Collapse
 
jonrandy profile image
Jon Randy πŸŽ–οΈ • Edited

Sometimes??? Most PR reviews degenerate into arguments (usually only within a team, not normally on open source stuff). Programming is a deeply personal thing, it's very difficult not to take review comments as a slight against you.

Collapse
 
moopet profile image
Ben Sinclair

The "you guys are getting paid?" meme but reading, "you guys are getting your PRs reviewed?"

Collapse
 
ingosteinke profile image
Ingo Steinke

As everyone is now doing test-driven pair-programming all of the time, why would we even need code reviews anymore? </irony>
But seriously, there are many possible reasons to feel defensive or uncomfortable in a code review. Maybe you had to finish something in a hurry and hope to get it shipped before an important "deadline". Maybe you had to rewrite "your" code several times to meet peculiar formal code style requirements that your coworker isn't aware of. Maybe you're in a probabation period and anxious to make a good impression. I've had all of this, including "public" code reviews in a meeting room with a bunch of coworkers delegated to stare at our PR "to learn something" , but the most annoying code review situation was when I refactored some nice code to meet the change requests of the first review, only to defend those changes against the second code reviewer, reviewing my refinements and requesting to revert the changes back to my original draft.

Collapse
 
panditapan profile image
Pandita

The 1st one I ever had yes, I was a bit defensive but I decided to not engage till the next day after my team destroyed the PR and I cooled off. I feel like they had been waiting for the opportunity since forever. After that they no longer destroyed my PRs and were pretty cool about it.

But it's been a while since I've been on a team that actively reviews code this way lol

Collapse
 
corners2wall profile image
Corners 2 Wall

In my opinion, this is a dialogue where you can discuss. In the discussion, you can also protect yourself.
I have seen a PR with over 100 comments from reviewers on other teams. If the comments are objective and justified, then this is better than their absence.

Collapse
 
ant_f_dev profile image
Anthony Fung

I did at first; I don't anymore.

Don't take it personally. You are not your code. If someone suggests a different way to do something, it is an opportunity to discuss. Maybe your way is better; maybe there's another way to approach the problem.

Keep in mind that if you are having your code PR'ed, it is being written for the team. The best communicators are the ones who can adapt what they're saying so that everybody regardless of skill level understands; the same is true with code.

You will not be the owner/sole maintainer of that code forever, even if you want to be (unless it's truly your own project, in which case you have the right to ignore the PR). Try to reach a compromise for everyone to agree.

Collapse
 
ypdev19 profile image
Yuli Petrilli

I would say it depends on how much back and forth happens about what we did vs what the reviewer was expecting and how that is communicated.

This can be hard sometimes but depending on the company culture/standards, it's better to try to let go any personal attachments and just address the reviews and be done with all that since at the end of the day the code won't belong to us.

Collapse
 
mfurmaniuk profile image
Michael

It's hard not to be, you've spent hours making a solution to the task you are given and think its ready and doing what it should, then you get critiqued on some point which then makes you feel you didn't do a good job. I've given constructive feedback which has at times riled someone's feathers because he thought he had solved just the problem he was given, but missed how the code was actually used. Took a lot of diplomacy to get past that.

When we still threw code over the wall to QA it used to be said in one place, "Developers code and give to QA, whose job is to tell Developers where they missed the mark."

Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard • Edited

That's so true, QA used to be the ones easing that tension!
Now we developers are both judge and defendant :)

Collapse
 
lionelrowe profile image
lionel-rowe

For work, I'm my own code reviewer (it's a small company).

As for contributing to OSS, I don't usually get defensive, no. I go in with the assumption that any PR I make might not get merged due to factors outside my control, but I'll argue the case for why it should get merged, unless something comes up during the discussion that changes my mind.

For nitpicks about code style etc I usually implement the requested changes without question.

There is one OSS project that's an exception, though, which has a weirdly insular and toxic community, especially one or two contributors who seem to take great delight in raising pointless objections to any attempt to approve the low quality of its code base... I won't name and shame, but such projects definitely exist. A lot depends on the community around specific projects.

Collapse
 
bandithijo profile image
BanditHijo 🌱

I did at first, but I don't anymore after making some mistakes at the production level. Now, I need it and am very dependent on it.

Collapse
 
bwca profile image
Volodymyr Yepishev

I don't, it's a learning opportunity. Besides the PR author and the reviewer are essentially in one boat.

Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard

Same boat yes, but often with strong conflicting opinions on whether to turn left or right :)

Collapse
 
camco profile image
Camco

Try not to get defensive.

If so.eone has something to say, they have a reason to do so.

If you do not agree with their reason, then try and consider why they feel they way they do, and then try to communicate to them what you did, why you did it. If they are upset at you, that's on them, not you.

Always do you best, and as long as you do, there's nothing to be mad about