How to Give Good Code Review Feedback
Fast recall
Quick revision
Core answer
Interview-ready guide
Interview answer
Effective code review feedback needs to be specific, constructive, and focused on the code rather than the person.
Start by being specific about what needs to change. Don't say this method is confusing. Instead, say this method mixes business logic with data access, which makes it hard to test.
Can we extract the database calls into the repository layer? That tells the author exactly what the problem is and gives them direction. Always explain your reasoning.
Don't just say use constructor injection. Say use constructor injection instead of field injection because it makes dependencies explicit and enables testing without Spring. When someone understands why a pattern is better, they'll apply it consistently.
Offer alternatives when possible. If you're saying an approach won't work, suggest what will work. Instead of catching all exceptions here, catch specific exceptions like IOException and let unexpected ones propagate to the global error handler.
One technique I use is prefixing comments to signal priority. I write nit for minor style issues that won't block the merge, like variable naming. I write suggestion for optional improvements that make code better but aren't critical.
I write question when I don't understand the approach and want the author to explain. And I don't use a prefix for required changes that block the merge, like security issues or missing validation. This helps authors know what to focus on first.
Another key point is focusing on the code, not the person. Say the code doesn't handle concurrent requests properly, not you forgot about concurrency. That keeps feedback objective and professional.
A common mistake freshers make is being too vague. They say this looks wrong or I don't like this but don't explain why or what to change. Another mistake is only pointing out problems without offering solutions or teaching the better pattern.
Code review is a mentoring opportunity.
How to Give Good Code Review Feedback
Direct Answer
Good feedback is specific about what to change, explains the reasoning, and offers an alternative instead of just criticizing. Use prefixes like nit versus blocking to signal priority, and always target the code, not the person.
Code Example
// Code under review
public class UserService {
@Autowired
private UserRepository repo;
public void saveUser(User u) {
repo.save(u);
}
}
// Poor feedback: "This is bad. Rewrite it."
// Good feedback examples:
// BLOCKING: saveUser does not validate the User before saving.
// Malicious input could bypass business rules. Add validation:
// if (user.getEmail() == null || !user.getEmail().contains("@"))
// throw new ValidationException("Invalid email");
// SUGGESTION: Prefer constructor injection over field injection.
// It makes dependencies explicit and simplifies testing:
// private final UserRepository repo;
// public UserService(UserRepository repo) { this.repo = repo; }
// QUESTION: Why does this return void? Should callers know whether
// the save succeeded or the user already existed?
// NIT: Variable name 'u' is cryptic. 'user' is clearer and costs nothing.
Notice how each comment names a problem, explains the impact, and offers a concrete fix.
Common Mistakes & Pitfalls
- Vague criticism without specifics: Saying this code is messy or this won't scale tells the author nothing actionable. They don't know what to change or why. Be specific: this method has three responsibilities and should be split into separate methods for parsing, validation, and persistence.
- Only pointing out problems without solutions: Telling someone their approach is wrong without suggesting alternatives leaves them stuck. If you know a better way, share it. If you don't, ask questions instead of criticizing.
- Treating all issues equally: Freshers block merges over minor style preferences while approving code with security holes. Learn to distinguish critical issues from nice-to-haves. Use prefixes like nit and suggestion to signal priority.
- Making it personal: Saying you didn't handle this case or you forgot to add tests sounds accusatory. Say the code doesn't handle this case or tests are missing for this path. Focus on the code, not the person.
Check your understanding
Answer these without looking back at the article.
- How do you handle disagreement during a code review?
- What is the difference between a suggestion and a blocking comment in GitHub PRs?
Looking for a structured roadmap?
Every module on this page is also part of the full Java backend interview track.