Top Banner
What Makes a Good Code Review? Oleksandr Tereshchuk Android dev, Stanfy LLC
24
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Stanfy MadCode Meetup: What Makes a Good Code Review

What Makes a Good Code Review?Oleksandr Tereshchuk

Android dev, Stanfy LLC

Page 2: Stanfy MadCode Meetup: What Makes a Good Code Review

Code review is systematic examination (often known as peer review) of computer source code. It is intended to find and fix mistakes overlooked in the initial development phase, improving both the overall quality of software and the developers' skills.

Code Review ?

Page 3: Stanfy MadCode Meetup: What Makes a Good Code Review

Formal (Fagan) code inspection

∗ Traditional process

∗ Very detailed inspection

∗ Can take too long time

Page 4: Stanfy MadCode Meetup: What Makes a Good Code Review

∗ Over-the-shoulder – One developer looks over the author's shoulder as the latter walks through the code.

∗ Email pass-around – Source code management system emails code to reviewers automatically after checkin is made.

∗ Tool-assisted code review – Authors and reviewers use software tools, informal ones such as pastebins and IRC, or specialized tools designed for peer code review.

∗ Pair Programming – Two authors develop code together at the same workstation, such is common in Extreme Programming.

Lightweight code reviews

Page 5: Stanfy MadCode Meetup: What Makes a Good Code Review

1. To spot and fix defects early in the process.2. Better-shared understanding of the code base.3. Maintain a level of consistency in design and implementation.4. A different perspective. “Another set of eyes” adds objectivity.

Similar to the reason for separating your coding and testing teams, peer reviews provide the distance needed to recognize problems.

5. Pride/reward. Recognition of coding prowess is a significant reward for many programmers.

Why ?

Page 6: Stanfy MadCode Meetup: What Makes a Good Code Review

Defect cost

Page 7: Stanfy MadCode Meetup: What Makes a Good Code Review

Some statistics...

Page 8: Stanfy MadCode Meetup: What Makes a Good Code Review

Roles

Author

Reviewer

Observer

Page 9: Stanfy MadCode Meetup: What Makes a Good Code Review

Responsibilities

Author

∗ Always check the code before submit

∗ Accept the critics

∗ Protect your decisions

∗ Maintain the coding standards

Reviewer

∗ Critique the code instead of author

∗ Ask questions rather than make statements

∗ Remember that there is often more than one way to approach a solution

Page 10: Stanfy MadCode Meetup: What Makes a Good Code Review

∗ Moderates review process

∗ Can check the code just to be aware of changes

∗ Can bring some special technical expertise

Observer (3rd person)

Page 11: Stanfy MadCode Meetup: What Makes a Good Code Review

Conflict of authorities

Page 12: Stanfy MadCode Meetup: What Makes a Good Code Review

Here is the moderator

Page 13: Stanfy MadCode Meetup: What Makes a Good Code Review

Proper communication

Page 15: Stanfy MadCode Meetup: What Makes a Good Code Review

∗ $489+ license cost∗ Wide VCS support∗ Informative reports∗ Consolidate review of code, issues, documents

Collaborator

Page 16: Stanfy MadCode Meetup: What Makes a Good Code Review

∗ Free public repositories∗ Great WebUI and IDE integration∗ Different collaborative development models∗ Pull request = code + issue + comments

GitHub

Page 17: Stanfy MadCode Meetup: What Makes a Good Code Review

∗ Robust Web interface∗ Only Git is supported∗ GitHub integration with GerritHub∗ Should be hosted on your infrastructure∗ Proven scalability and security

Gerrit

Page 18: Stanfy MadCode Meetup: What Makes a Good Code Review

∗ Github/Gitlab as in instrument∗ Author requests a review∗ “Two fingers” rule∗ Share the knowledge∗ Automate everything

Stanfy way

Page 19: Stanfy MadCode Meetup: What Makes a Good Code Review

Request a review

Page 20: Stanfy MadCode Meetup: What Makes a Good Code Review

Automate

Page 21: Stanfy MadCode Meetup: What Makes a Good Code Review

“Two finger” rule

Page 22: Stanfy MadCode Meetup: What Makes a Good Code Review

∗ Tools do not matter, but people - do∗ Regular code reviews help to avoid about 60% of bugs∗ Accept the critic∗ Use checklists∗ Treat reviews comments as a document

Summary

Page 24: Stanfy MadCode Meetup: What Makes a Good Code Review

[email protected]

rivne2

@Vandalko

Questions ?