Positive Reinforcement
Let’s look at how to provide positive reinforcement in code reviews. We’ll show you a simple example and explain why the feedback matters.
The Scenario
A developer has written code to handle user data validation. The code works well and follows good practices.
userValidation.ts
// Code
function validateUser(user: User) {
if (!user.name || !user.email) {
throw new Error('Invalid user data')
}
return true
}PR Comment
Choose the comment that you think is the most constructive and helpful.

Tedi Coffeecommented on Apr 2, 2025
The validation logic is well implemented.
Click here to learn more
Improvements
1. Code Quality
- Clear error messages
- Comprehensive validation
- Well-structured code
2. Maintainability
- Easier to understand
- Easier to modify
- Clear responsibility
3. User Experience
- Better error handling
- Clear feedback
- Improved debugging
Tips
1. Be Specific
- Point out exact strengths
- Explain why they matter
- Example: “The clear error messages help with debugging”
2. Highlight Impact
- Show how it helps
- Explain the benefits
- Example: “This provides better user feedback”
3. Encourage Growth
- Reinforce good practices
- Suggest future improvements
- Example: “This is a great pattern to use in other validations”
4. Keep It Genuine
- Focus on real strengths
- Be specific and honest
- Example: “The separation of validation rules is particularly helpful”
Common Pitfalls to Avoid
1. Being Too Generic
- ❌ “Looks good.”
- ✅ “Great work! The clear error messages help with debugging.”
2. Missing Details
- ❌ “Nice validation.”
- ✅ “The comprehensive validation prevents invalid data from entering the system.”
3. Not Explaining Why
- ❌ “Good job.”
- ✅ “Great work! This makes the code more maintainable.”
Remember: The goal is to help your teammate write better code while maintaining a positive and collaborative environment!
Last updated on
Looks good.