Hidden sides of Code Review
Dmitrii Ivanov, iOS Engineer
@ OneApp Capabilities (NL)
OneApp
> 50 developers per platform
Goals of Code review
1. Quality assurance
2. Knowledge sharing (in both directions)
3. Giving another perspective
4. Collective code ownership
(WHAT needs to be done)
What is a good Code Review?
• The goals are achieved (QA, Knowledge sharing, Another
perspective, Shared ownership)
• The least possible time spent
• The process is as pleasant as possible
(HOW should it be done)
3 angles
Communication
2
Psychology
3
Work processes
1
Communication
2
Psychology
3
Work processes
1
Development process
Problem
Design
Implementation
Development process
Problem
Design
Implementation
Code Review
Problem Validation
Design Review
Development process
Problem
Design
Implementation
Problem Validation
Design Review
Code Review
Don’t skip feedback loops
Problem
Design
Implementation
Problem Validation
Design Review
Code Review
Tip
Don’t skip feedback loops
Problem
Problem Validation
Design
Implementation
Design Review
Code Review
Tip
Don’t skip feedback loops
Problem
Problem validation
Design
Implementation
Design Review
Code Review
Tip
Don’t skip feedback loops
Problem
Problem validation
Design
Implementation
Design Review
Code Review
Tip
Make Code Review your habit
“Make the desired behaviour easier then
unwanted behaviour”
Tip
Make Code Review your habit
• Make the desired behaviour easier
• Code Review is an important responsibility
• Make it a daily routine
• Don't make the author ask (twice)
Tip
Minimise the scope
• Stay focused
• Separate different types of activities (changes, refactoring,
integration, cleanups)
• Separation helps parallelisation
• Separate Design Review from Code Review
• Use automation (linters, formatters, static analysers)
tip
Author
Respect the scope
• If the code is not touched, don't ask to improve it
• but "touched" code might be just moved (out of scope)
• but "untouched" code might be misaligned now: function name -
content - comment (in scope)
• Special remarks and special treatment for "out of scope" comments
tip
Reviewer
Review your own PR
• Respect reviewer's time
• Stupid mistakes, TODOs, debug logs, temporary commented code,
formatting, ...
• Use "fresh eyes" if possible
tip
Author
Author's checklist
tip
Author
Ensure proposed change is focused on one topic
􀁣
Use a short and clear Pull Request title
􀁣
Describe what has changed and why
􀁣
Add screenshots (if applicable)
􀁣
Update localised strings (if applicable)
􀁣
Implement analytics (if applicable)
􀁣
Update documentation
􀁣
Implement unit tests and/or UI tests
􀁣
Test changes against showcase app
􀁣
Consider possible security impact
􀁣
General Tests
Security
Reviewer's checklist
• Same as for author: automation tests, localization, logging,
analytics, style guide, security impact, error handling,
documentation, entry into the change log
• Speci
fi
c for reviewer: conformance to the design, performance,
naming, readability, code duplication, single responsibility, external
dependencies, consistency ...
tip
Reviewer
Start high level
High-level architecture
Interfaces between components
Components (modules, scenes, features)
Data structures
Functions
tip
Reviewer
Distinguish objective and subjective
• Objective points
• violation of architecture, ef
fi
ciency, maintainability, testability,
security, consistency, style guide…
• author misses some context or edge case
tip
Reviewer
Distinguish objective and subjective
• Subjective points
• readability
• confusion
• different approach
• Mark subjective: "imho", "suggestion", “pp"
tip
Reviewer
Approve when only minor/subjective
are left
• A sign for the author: generally all good; can be improved, but
already good enough to be merged
• A sign to yourself: easier review if more changes are pushed
tip
Reviewer
Avoid repetitive comments
tip
Reviewer
URL in names of the classes should be capitalised as it's an
acronym (here and in all the other cases like
AgreementsApplicationUrl or ChatExternalApplicationUrl)
Good 👍
Avoid repetitive comments
tip
Reviewer
Ca we capitalise URL here as it’s an acronym?
URL-capitalisation (same as here)
URL-capitalisation (same as here)
Also good 👍
Don't mix several points in one discussion
tip
Reviewer
Bad 👎
Keep valuable discussions in PR
Tip
Bad 👎
Keep valuable discussions in PR
Tip
Resolved in person. We've checked together all the cases in
Payments and everything works as before
Communication
2
Psychology
3
Work processes
1
Communication is hard...
😓 between technically-skilled introverts who mostly communicate
with computers
😓 between people of different cultures
😓 when held in writing, without all the nonverbal means of
communication like facial expressions, tone of the voice, body
language
😓 when somebody is emotionally attached to the subject
Communication is hard...
✅ between technically-skilled introverts who mostly communicate
with computers
✅ between people of different cultures
✅ when held in writing, without all the nonverbal means of
communication like facial expressions, tone of the voice, body
language
✅ when somebody is emotionally attached to the subject
Channel
Message
Feedback
Receiver
Sender
Decoding
Decoding Encoding
Encoding
Reviewer
Author
Azure
PR
Review
Reviewer
Author
PR
Message
Message
Reviewer
Author
A good message is...
• Complete
• Concise (but completeness is a priority)
• Coherent (meaning logical, well-structured)
• Clear (clear to understand: no ambiguity, nothing misleading; as prepared to
be consumed as possible)
• Considerate/courteous (good manners, showing respect)
• Concrete (speci
fi
c and to the point, about the entire message as well as about
separate words used; using evidence and examples when relevant)
Applicable rules of communication
• Seek an understanding, don't be defensive
• Manage your emotions, don't make it personal
• Use visuals if it helps
• Stay focused on the topic
• Base your words on facts
• Don't stretch the conversation/argument for too long. But take breaks when needed
• Speaker: elaborate as clear as possible, listener: clarify, don't assume
Add screenshots and schemes
VS
Tip
Link to authoritative resources
• Trusted sources: Apple documentation, Swift Blog/Forum, Our
style guide
• Use with attention: Highly voted comments at StakeOver
fl
ow, blog
posts
Tip
If the discussion stalls
• Talk in person (verbal communication)
• Take a brake
Tip
Resolve discussions properly
• Disagree? - explain why
• Agree? - make it clear ("done", "
fi
xed", "changed")
tip
Author
Comment on your own PR
tip
Author
Good 👍
PR
Message
Message
Reviewer
Author
Decoding
Decoding Encoding
Encoding
Context Context
What makes a context?
Context
Problem
Domain knowledge
UI
Of
fl
ine discussions
Messages in PR
Context
Problem
Domain knowledge
UI
Of
fl
ine discussions
Messages in PR
Programming experience
Native language
Upbringing
Manner of communication
Culture
Shareable context
Problem
Domain knowledge
UI
Of
fl
ine discussions
Messages in PR
Make a proper PR description
• The problem
• High-level solution
• Valuable details
• The most important changes
• Where to start from
• Screenshots
• Impact on other features
tip
Author
Share enough context in comments
tip
Reviewer
Good 👍
Bad 👎
Non-shareable context
Programming experience
Native language
Upbringing
Manner of communication
Culture
Non-shareable context
Programming experience
Native language
Upbringing
Manner of communication
Culture
Leading
Egalitarian Hierarchical
NL RO
Task-based Relationship-based
NL RO
Trusting
Egalitarian Hierarchical
RO
NL
Leading
Trusting
T
ask-based Relationship-based
RO
NL
Low-context High-context
RO
NL
Communicating
Evaluating
Direct negative feedback Indirect negative feedback
RO
NL
Deciding
Consensual Top-down
RO
NL
Confrontational Avoids confrontation
RO
NL
Disagreeing
Scheduling
Linear time Flexible time
RO
NL
Persuading
Principles first/specific Applications first/holistic
RO NL
Egalitarian Hierarchical
RO
NL BE DE
Leading
Trusting
T
ask-based Relationship-based
RO
NL DE BE
Low-context High-context
RO
NL BE
Communicating
Evaluating
Direct negative feedback Indirect negative feedback
RO
NL
Deciding
Consensual Top-down
RO
NL
Confrontational Avoids confrontation
RO BE
NL
Disagreeing
Scheduling
Linear time Flexible time
RO
NL
Persuading
Principles first/specific Applications first/holistic
RO NL
DE
DE BE
BE DE
DE
DE BE
BE DE
Communication
2
Psychology
3
Work processes
1
Admitting mistakes
• Code Review is for
fi
nding the mistakes
• People don't like own mistakes
• Tension and confrontation
Self-work association
• We all tie self-worth with work results
• Extreme case - “workism"
• The
fl
aws in our work are perceived as personal ones
• Makes it harder to admit mistakes
Emotional attachment
• We get attached to the results of our work
• Discussion in a PR: 2 parents arguing about the future for the child
Relevant psychological phenomena
• It's dif
fi
cult to admit mistakes
• Mistakes !=
fl
aws in skills or personality
• Stay objective when discussing the work
Don't be personal
tip
Reviewer
Bad 👎
Bad 👎
Don't be personal
tip
Reviewer
Good 👍
Don't be personal
tip
Reviewer
Good 👍
Bad 👎
Don't treat feedback personally
tip
Author
Bad 👎
Don't treat feedback personally
tip
Author
Still bad 👎
Good 👍
Extra care to the PRs of new joiners
tip
Reviewer
PRs are not only for critique
tip
Reviewer
Good 👍
Thanks for listening!
All tips and references

Hidden sides of Code Review (MMM-2023)