Effective
Code Review
Jane Prusakova
@jprusakova
Effective
Code Review
Jane Prusakova
@jprusakova
Judge a coder by the code?
Cooperation, not competition
Attention is respect
Everyone is a reviewer
Size matters
• Consistent criteria
• Maintain focus
• Be agile
• Limit scope
• Limit time
Bucket list
Visual layout
Naming
Architecture
Test coverage
• Is it readable*?
• Is it good
maintainable
code?
• Does it do what it
appears to do?
Skip
Explanations what the code does
Checks by automated tools
Reasons why this code is bad
Arguments about preferences*
Code review is NOT
A substitute for the QA
A check on automated tools results
A discussion on formatting, tools, or patterns
All code must be perfect?
It depends
Goals of code review
Immediate benefit
Medium to longer-term improvements
Building technical community
Good Code
Worthy of a compliment
Bugs
Unintended
behavior
Bad
Code
Bugs coming
soon
Erratic
code
Hard to
understand
Common Vision
-ilities
Dependencies
Poor scalability
Code review is not a meeting
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
Preparation Conversation Follow up
Author Reviewer(s)
Code review is not a meeting
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
Preparation Conversation Follow up
Author Reviewer(s)
Author
Verify test coverage
Run code quality tools
Fix problems
Reviewer
Be prepared
Learn requirements
Read the code
Read the tests
What is readable code?
Defined by technology community
Common knowledge
Expected tenure
Popular tools
Readability
Short code blocks
Minimize nestedness
WYSIWYG
Show logic
One decision per code block
Visible assumptions
D.R.Y.
Test every scenario exactly once
Naming
 Make sense
 Accepted terminology
 Abbreviations
 As short as possible
 but not any shorter
 Easy to distinguish
String result, response, received;
Integer value, values;
MainClassHelper aHlpr;
SituationUtils utils;
PersonalDetails personsDetails;
PersonalsDetails adCollectionDetails;
Code quality
Architecture
Architecture
Code reflects understanding
Architecture
technical details
Standard practices
Consistent patterns
Reflects requirements
Builds on prior knowledge
Tests
All scenarios covered
No repetitive tests
Robust test structure
Outcome
Learning
Recommendations
Try-it-out
Follow up
Review the recommendations
Make changes
Apply learning
Write more code
Prepare for the next code review
It is OK
Challenge the advice
Do more research
Ask for clarification
Technical Quality
Takes time
Takes a community
Takes iterations
Write
code
Prepare
for code
review
Code
review
Follow
up
Bugs
Unintended
behavior
Bad
Code
Bugs coming
soon
Erratic
code
Hard to
understand
Common Vision
-ilities
Dependencies
Poor scalability
Good Code
Worthy of a compliment
Code review is like pants.
If you work alone, pants are optional.
But if you are part of a team, make sure you
have pants on.
Effective
Code Review
Jane Prusakova
@jprusakova

Effective Code Review