Why Review?
● Catch/ Prevent Bugs
● Identify Potential Problems
(not "bugs" but performance,
security, etc)
● Improve Maintainability of
Code
● Improve Communication and
Understanding
Code Review: Careful examination of
code, looking for mistakes and
attempting to improve overall quality.
4.
Types of Code
Review
●Formal
○ Multiple Days
○ Multiple Reviewers
● Informal
○ Faster
○ Not always documented
○ Just as effective!
5.
Pull Request Reviews
●Useful for impacting the writer's skills and habits
● Cross-Team Code Review: maintainable code
● Small Frequent PRs:
○ Clear, Readable Code enables reader to understand context & purpose quickly
○ Empower everyone to review code, so everyone can contribute to review
● Don't rely on one/few reviewers
6.
Sprint Retrospective Reviews
●Useful for reviewing & communicating out to team
○ Purpose of code / feature
○ Explain new libraries / dependencies
● Extra eyes to catch any remaining flaws
● Demonstrate / enforce good habits
Attention Coders!
● Remember:
○You are not your code
○ The Bugs are the enemy, not QA
/ Reviewers
● Your Responsibilities:
○ Document your code
○ Review your code
Provide Positive Feedback
●Applies newly introduced or difficult concepts
● Easily understood code, well named classes, uses third party library
appropriately, etc.
● Uses design patterns appropriately
15.
Observe, Don't Interpret
Interpretationsare what you think is
happening
● "You're trying too hard to be clever and
save lines of code here, just write it out!"
Observations are things you see
● "I think this might be easier to read if it
was separated out into multiple
statements with assignments, like this:"
Interpretation Observation
16.
Review the Code,Not the Coder - Don't Say "You"
● "You used the wrong logical comparison
here"
● "You should use a factory!"
● "Does the logic of this feature mean this
should be a triple equal (===) instead of
the double (==)?"
● "Could we use a factory here to help
prevent coupling?"
"You" Statement "Code" Statement
17.
Suggest, Don't Demand
●"This loop is repeated in this other
method too, and so it needs to be
refactored into a separate method"
● "Could we refactor this section here into
a separate method? It would reduce
duplication in the method above as well"
Demand Suggestion
18.
There is no"Just Do It"
Implies it's easy, obvious, quick
● "Why didn't you just use *Library X*?"
Suggest solution and explain the benefit of it
● "Could we use *Library X* here instead
of rolling our own? It could save us a lot
of time in the future, and it's well tested"
"Just" Just don't "Just"
19.
Avoid Absolutes
● "Neverrun queries in loops!" ● "Our best practices guide says queries in
loops are bad for performance, is there
a better way we can do this?"
Never, Always, Must… Ask for Explanation
Be On TheSame Team!
● "Can you rewrite this to use a Singleton?' ● "Could we rewrite this to use a
Singleton?"
Against Together
22.
Phrasing!
Effective Feedback
● Providepositive feedback
● Observe, don't interpret
● Review the code, not the
coder
● Suggest, don't demand
● Don't "just do it"
● Avoid absolutes
● Discuss large / complicated
concepts in person
● Remember to be on the same
team!
After A Review
●Confirm bugs are fixed /
changes are made
● As Needed: Discuss in
person, then document
25.
Effective Code Reviewin One Slide
● Automate All The Things!
● Self-Review
● Review often, slowly and carefully, for
shorter periods
● Empower everyone to review
● Follow a review checklist
○ Logic, business benefits documented,
readability & maintainability, security,
performance and TESTS!
● When sharing your feedback:
○ Empathetic
○ Polite
○ Suggestions
○ Teamwork
● Follow up