Code Review & Refactoring
Systematic approaches to code quality, identifying code smells, refactoring patterns, and building review culture
Code review: systematic examination of code before merging.
Purpose: catch bugs early (cheaper than production), share knowledge (team learns patterns), maintain standards (style, architecture), improve quality (readability, maintainability).
Types: pre-commit review (before merge), post-commit review (after merge, less common), pair programming (real-time review).
Best practices: review small changesets (<400 lines), provide actionable feedback, focus on logic over style (automate style checks), review within 24 hours, be respectful and constructive.
Checklist approach: Does code solve the problem? Are there edge cases?
Is it testable? Does it follow team conventions?
Are there security issues? Metrics: review turnaround time, defects found, review coverage (% of code reviewed).
Real-world: Google requires code reviews for all changes; Microsoft uses detailed review guidelines; open-source projects (Linux kernel) have rigorous review processes.