DEV Community

Cover image for Non-Violent Code Reviews
Niels Theen
Niels Theen

Posted on

Non-Violent Code Reviews

To offend somebody is pretty easy, even in code reviews. To criticize somebody without hurting feelings can be hard.
This article shall help to do code reviews without insulting others.

Don't use strong language 💥

To don't use strong language should be normal for people working in professional environment. Sadly this is not the case every where.
But this should be avoided at any price, even if it is used in a sarcastic way.
Watch out! Using sarcasm is always an indicator that something is wrong in the communication.

Stop asking rhetorical question 💭

Don't ask rhetorical question nobody can answer.
Especially if you are angry: "And that's why you also changed it without telling anyone what would happen?"
There are not many people out there that do something bad on purpose.

Ask them what happened to lead to the current situation and don't ask questions nobody can answer.

Separate the work from the person 🗄️

"You changed the dependency..."
A comment that we all may know. The problem is using "you" will always implicate that the person did the change on purpose.

Criticize the work without talking with person directly.
Instead of using "Your changes..." say "These changes..." or "You should make..." to "What do you think about changing to...". Don't hesitate to use more words, even it costs you more time. Hurting people for a faster code review as never worth it. Take your time to find words that try to separate the work from the person.

Giving reviews is about motivating people. Review and criticize people is hard, not many people like to critizes others. Most of us work in teams and we have to work with them for a long time and nearly everyday.

Try to avoid using "Bob changed this code because..." and try to involve others: "This code was changed because...".

Be nice, you will realise how a positive communication jumps over to other people.

Talk like a team 👥

We all work in teams. Even solo developers need to communicate with others.

In reviews try to include everybody: Instead of saying "You should change it to ... " say "We should change it to ...".
And try to start discussions by asking for opinions "What do you think?".
The reason to ask for feedback is to realize how other people thing and the best thing is you can learn
new things, by asking for feedback.
And one bonus point people love to be asked about stuff they know something about.

Appreciate the work 🙏

People supposed to their job, but it does not always match with the expectations.
Maybe its the best the person could do at the current state of knowledge. Maybe this knowledge is missing? And maybe you are the first person who could help? How awesome is that.

Try to lift people the best version of themselves. And try to appreciate the work they did so far.

Praise good work 🎖️

Good work is not a matter of course. If they made a great job: Tell them, nobody else will.

That's it for it moment.
What about you?
What do you think can help create better code reviews?
Did you are your experiences so far?

Top comments (0)