This video features an interview with Shandor, discussing his upcoming talk titled "Code Reviews: Building Better Code and Stronger Teams." Shandor shares his journey with C++ from initial dislike to comfort, emphasizing how mentorship and active learning through code reviews transformed his perspective. The discussion delves into the multifaceted nature of code reviews, highlighting their role in improving code quality and fostering stronger team dynamics, but also acknowledging their potential as a source of stress and conflict. Key topics include strategies for providing constructive and empathetic feedback, the importance of detailed explanations and external references in comments, the evolving role of AI as a code review assistant (not a gatekeeper), effective mentoring through the review process, and approaches to managing reviewer workload and team dynamics. Shandor stresses the critical impact of communication and tone on team collaboration and individual growth.
Summarizing the Interview with Shandor on Code Reviews
0:00 Introduction to Shandor: Shandor, a C++ developer at Spotify (previously Emos), initially disliked C++ but grew to appreciate it through dedicated learning and a good mentor. He now enjoys diving into new C++ standards and sharing his knowledge through blogging.
0:48 His Upcoming Talk - Dual Focus: Shandor's talk, "Code Reviews: Building Better Code and Stronger Teams," will explore both the technical aspects of writing better code and the human element of improving team collaboration. He believes these two aspects are tightly interconnected for sustainable team performance.
3:45 Importance of Constructive Feedback: Code reviews, while vital for knowledge sharing and skill development, can be a source of stress. Shandor emphasizes avoiding negative comments and instead making propositions, asking questions ("Have you thought about this?"), and explaining why a different approach might be better.
7:41 Leveraging References and Templates: To enhance credibility and facilitate learning, reviewers should share external references (blog posts, conference talks) to support their suggestions. Shandor also recommends creating personal templates of common comments and references to save time, especially when working with multiple teams.
10:40 Tools and Markdown for Comments: While the specific tools for code reviews vary by company (Bitbucket, GitHub), Shandor highlights the importance of using Markdown to format comments nicely, improving readability and impact.
12:04 AI in Code Reviews (Copilot): Shandor confirms Spotify uses AI (Copilot) for automated code review comments, but notes that initial low quality led to developers ignoring them. He sees AI as useful for personal assistance (e.g., transforming raw loops into standard algorithms) before submitting a pull request, but not as a gatekeeper due to its limitations in understanding internal APIs and generating accurate suggestions.
14:17 The Human Side: Avoiding Misinterpretations: Code reviews often lack the tone and gestures of in-person communication. Shandor shares an anecdote where informal "fun" comments between friends in a PR were misinterpreted by another team, emphasizing the need to consider the audience. He advises thinking twice about how comments will be read, as poorly articulated feedback can harm team dynamics and lead to developers avoiding certain reviewers.
24:59 Key Takeaways for Reviewers: Shandor wants people to understand that their choice of words and the perceived "tone" of their comments significantly impact others. He stresses the importance of timely reviews (especially for senior team members to avoid blocking others) and providing clear explanations with references rather than just stating "use this" to foster genuine learning. He playfully suggests future tools might include voice or video clips for comments.
28:04 Code Reviews as a Mentoring Tool: Code reviews are an excellent vehicle for mentoring. Reviewers can mentor by providing context, information, and references. Authors can mentor by adding self-comments to their pull requests, explaining their design choices, the "why" behind using specific standard features, and providing references without cluttering the main codebase. This is especially valuable when junior developers review senior code.
31:16 Reviewer Selection and Load Balancing: In Shandor's experience (13+ years), reviewers are typically "free for all," meaning anyone can review. Teams with more junior members often require at least two approvals. He advocates against restricting who can approve reviews, as it can hurt team dynamics and load balancing. Load usually self-balances, but sometimes needs reminders in team meetings or dedicated chat channels for PRs.
35:14 Value of Junior Reviewers: Junior developers, eager to learn, often review code line-by-line, catching typos and questioning variable names β details that senior developers might overlook while focusing on higher-level architecture. This process also significantly aids junior developers' learning.
36:37 Personal Learning from Code Reviews: Shandor credits code reviews as his primary source of fundamental C++ knowledge, learning everything from basic concepts like passing parameters by const reference to discovering new standard library features.
38:55 Code Guidelines and Automation: Shandor believes that many code guidelines (e.g., style, formatting, static analysis checks) should be automated rather than manually checked during reviews, as manual checks are tedious. Some teams have guidelines on what to look for (testing, security, meaningful names), but formal "how to review" guidelines are less common, though he sees potential value in them.