24
What Makes a Good Code Review? Oleksandr Tereshchuk Android dev, Stanfy LLC

Stanfy MadCode Meetup: What Makes a Good Code Review

  • Upload
    stanfy

  • View
    88

  • Download
    0

Embed Size (px)

Citation preview

What Makes a Good Code Review?Oleksandr Tereshchuk

Android dev, Stanfy LLC

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 ?

Formal (Fagan) code inspection

∗ Traditional process

∗ Very detailed inspection

∗ Can take too long time

∗ 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

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 ?

Defect cost

Some statistics...

Roles

Author

Reviewer

Observer

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

∗ Moderates review process

∗ Can check the code just to be aware of changes

∗ Can bring some special technical expertise

Observer (3rd person)

Conflict of authorities

Here is the moderator

Proper communication

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

Collaborator

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

GitHub

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

Gerrit

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

Stanfy way

Request a review

Automate

“Two finger” rule

∗ 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

[email protected]

rivne2

@Vandalko

Questions ?