Code reviews are amazing. They're our best opportunity to get recurring feedback as developers, making them crucial to the development of our skills. Unfortunately, we often write 200 lines of good code when all that gets noticed is the one line we format incorrectly. This is embarrassing. We're humans, not robots. We need feedback on all the work we do, both good and bad, especially when we're working with deadlines in a complex environment.
With that in mind, let me offer a simple suggestion for when you give code reviews:
Give as much positive feedback as you do correction.
It’s About Calibration
It feels great to receive encouragement, but it’s not just about improving morale. Giving positive feedback reinforces the behavior that you want to see. When you don’t provide this feedback, you imply that all the code you see is of equal value. Is it? The last thing you want is to have a detail-oriented team member start taking shortcuts because they are praised for building fast and not for building right.
So postive feedback is good, but why aim for equal amounts of positive and critical feedback? It’s because the developer writing more mistakes into their code tends to be, on average, the developer who needs more support. New team members and junior developers need to know when they are doing things right because that’s how they test their assumptions and calibrate their behavior. These early calibrations reduce rework, increasing team efficiency and confidence. Also, setting a goal to literally give as many positives as negatives is a helpful heuristic for getting in the habit.
Find the Good
The typical pull request is chock full of good work. Did you see someone refactor something in the course of their work? Did they pick good names for their variables, functions, or CSS classes? Did they use a clever approach to solve something—perhaps a technique you didn't know about? Are their code comments useful? Did they add documentation? Did they add tests? Are they successfully adopting new standards or patterns? Any of these things (and more) are praiseworthy. I've never seen a pull request where I couldn't find one good thing worth mentioning.
Be the Good
Giving positive feedback is an easy habit to adopt. You're already reading through the lines of code, looking for issues. It doesn't take much time to throw in a "Nice!" or "Looks great!" If you see something awesome, say it!
If you're in an environment that produces a lot of negative code reviews, then be the good that you want to see. Start giving positive feedback (as often as you give correction) in your code reviews, and make your work environment a happier place for everyone.