
Ask HN: How do I avoid coming off as harsh during code reviews? - finaliteration
I&#x27;m a senior developer on a team with 3 other junior developers. Before I joined the team, they weren&#x27;t doing any sort of code reviews&#x2F;pull requests and I recently implemented a process for submitting pull requests and getting approvals, etc, before merging and building.<p>My problem, however, is that I feel like I come off too harsh when I make comments on pull requests. I don&#x27;t ever launch into personal attacks, but I do tend to keep my comments pretty matter-of-fact or dryly suggestion-based (&quot;Our style guide says X&quot;, &quot;I think it&#x27;s better if we do X here&quot;, &quot;Class names should start with an uppercase letter&quot;, &quot;What if we use X here?&quot;). It&#x27;s not that my comments feel mean or hurtful, but more that they possibly lack empathy? Also, no one has said that I come off as harsh, I&#x27;m just pre-empting any issues because I know how much I hate working with people who seem hypercritical or tone-deaf.<p>Or maybe comments like those are totally fine and I&#x27;m overthinking this?
======
mikece
You could try what's called a "sandwich technique" where you preface and
follow your constructive criticism with positive feedback. A highly
exaggerated example could be: "Your code shows amazing creativity and
imagination -- I like that! But this section isn't as efficient as it could
be; in fact, using a common algorithm -- like the one I'll send you by email
in a moment -- you could speed up this function 3200x. You've got great
passion and insights -- keep up the great work!"

~~~
finaliteration
Interesting thought! What about if there's not really anything there to
"praise", but it's just a chunk of code with some things that are off?

~~~
mikece
Have a conversation. As a code reviewer you're looking to increase the
understanding of the person whose code you're reviewing -- which starts with
understanding why they wrote the code they way they did. Some people simply
understand things differently and what's intuitive to them isn't to others.
Consider the code sample I talk about in the following blog post: the only
thing that's "wrong" about it is that it's probably not obvious to anyone
other than the author.

URL: [http://www.mikece.com/2015/08/clean-code-vs-really-clever-
co...](http://www.mikece.com/2015/08/clean-code-vs-really-clever-code/)

------
ignorantguy
I think you are doing great! It is hard to convey empathy with comments. As
long as your interpersonal relationship with the junior developers is fine, I
wouldn't worry too much about it.

~~~
finaliteration
Thanks! I just don't want anyone to think I'm being critical of them as a
person. My main goal is to share and help the less experienced folks learn.
It's just hard to do via PR comments where there really isn't a whole lot of
opportunity for touchy-feely stuff.

