a study of the quality-impacting practices of modern code review at sony mobile

67
1 Junji Shimaga ki Yasuta ka Kamei Ahmed E. Hassan Naoyas u Ubayas hi Shane McInto sh A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Upload: sailqu

Post on 15-Apr-2017

138 views

Category:

Software


0 download

TRANSCRIPT

Page 1: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

1

Junji Shimagaki

Yasutaka Kamei

Ahmed E. Hassan

Naoyasu Ubayashi

Shane McIntosh

A Study of the Quality-Impacting Practicesof Modern Code Review at Sony Mobile

Page 2: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

2

Code review is an importantsoftware quality assurance practice

Programmer Code reviewer

Page 3: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

3

Sony Mobile usesGerrit Code Review

tools

1. Commit message

2. Files under review

Page 4: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

4

Sony Mobile usesGerrit Code Review

tools

1. Commit message

4. Review scores

3. Reviewers

2. Files under review

Page 5: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

5

Code Review context at Sony Mobile

“Code-Review”. (e.g., syntax, grammar, logic..)

Page 6: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Code Review context at Sony Mobile

“Code-Review”. (e.g., syntax, grammar, logic..)

Test results onApplication crashes?

Reboot after 10 sec6 ?

Page 7: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

7

Lax reviewing practices impact software quality

Reviewer Programmer

Poorly reviewed code

Code repository

McIntosh et al., EMSE 2015

Page 8: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Poorly reviewed code

ReviewerProgrammer

Code repository

McIntosh et al., EMSE 2015

8

How about at Sony Mobile?

Lax reviewing practices impact software quality

Page 9: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

9

ApproachQuantitative

study

Qualitative study

Replication of McIntosh et al.,

EMSE 2015

Developer surveys at Sony Mobile with 100+ people

Implications

Better code review practices

validated by stakeholders

Page 10: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

10

Review participation

Quick resultsSimple adaptation does not work!

Review coverage

Self approval✗Discussion volume✗

Un-review ratio✗

Page 11: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

11

Sony's unique apps, HW

A software project for this.

Target system: A smartphone product of a release cycle for 6 months

Page 12: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

A software project for this.

Target system: A smartphone product of a release cycle for 6 months

Sony's unique apps, HW

Chipset and modem

Android OS

Strong dependencies on third-party system12 s

Page 13: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Why might Sony Mobile be Different?

Third-party dependencies

OfflineCommunication

Embedded Software

Development

13

Page 14: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Third-party dependencies

Why might Sony Mobile be Different?

EmbeddedOffline SoftwareCommunication Development

Previous studied systems areless impacted by third-party dependencies.

14

Page 15: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Third-party dependencies

Why might Sony Mobile be Different?

Embedded Software

DevelopmentOffline

Communication

Previous studied systems rely on online communication methods. 15

Page 16: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

16

Why might Sony Mobile be Different?

Embedded Software

Development

Third-party Offlinedependencies Communication

Previous studied systems are of applications at higher levels in the application stack

Page 17: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Do reviewing practices impact software quality?Review coverage

Un-review ratio

Third-party ratio

✗✓

Components with higher third-party codebase ratio are more defect-prone17

Page 18: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Review participation

Do reviewing practices impact software quality?

Discussion volume

Patch update activity

✗✓

Components with high patch update activity are less defect prone. 18

Page 19: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Review participation

Do reviewing practices impact software quality?

Self approval

Self verify

✗✓

Components which are prevailed with self verification practices are more defect prone

19

Page 20: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

20

Do reviewing practices impact software quality?Review coverage

Self verify

Third-party ratio✓

Review participation

✓ Patch update activity

Page 21: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Do reviewing practices impact software quality?Review coverage

✓ Third-party ratio

Review participation

✓ Self verify

✓ Patch update activity

21

Why are these metrics effective?Let's ask the developers!

Page 22: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

22

Qualitative Study Approach

Presentation

Initial survey (93 stakeholders)

–---------–-------–---------–-------

–---------–-------–---------–-------

–---------–-------

–---------–-------

Interviewee's list

–---------–-------

–---------–-------

–---------–-------

–---------–-------

Page 23: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

23

Qualitative Study Approach

Semi-structured Interviews(15 key engineers)

Presentation

Initial survey (93 stakeholders)

–---------–-------–---------–-------

–---------–-------–---------–-------

–---------–-------

–---------–-------

–---------–-------

–---------–-------

–---------–-------

–---------–-------

–---------–-------

–---------–-------

Interviewee's list Implications

–---------–-------

–---------–-------

–---------–-------

–---------–-------

Page 24: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Qualitative Study Approach

Semi-structured Interviews(15 key engineers)

Presentation

Initial survey (93 stakeholders)

–---------–-------–---------–-------

–---------–-------–---------–-------

–---------–-------

–---------–-------

–---------–-------

–---------–-------

–---------–-------

–---------–-------

–---------–-------

–---------–-------

Interviewee's list Implications

–---------–-------

–---------–-------

–---------–-------

–---------–-------

Validation survey (25 senior stakeholders)

–---------–-------–---------–-------

–---------–-------–---------–-------

–---------–-------

–---------–-------

ConfirmedImplicatio24ns

–---------–-------

–---------–-------

–---------–-------

–---------–-------

–---------–-------

–---------–-------

Page 25: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

“An external codebase takes more time from me to understand the code and to develop patches.”

Developers require more time and effort to understand, extend, or repair components with

high third-party rates.

Why does third-party ratio matterat Sony Mobile?

Software engineer

✓92% of stakeholders agreed 25

Page 26: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Why does self-verify rate matterat Sony Mobile?

The self-verification practice is coloured by the author’s subjective

perspective,which may bias the testing procedures and

results.

“I understand the architecture, and I am the one who can test my commit properly.”

Software engineer

✓75% of stakeholders agreed 26

Page 27: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Why does patch update rate matter at Sony Mobile?

“Patch updates rate” captures developer effort in a way that is not diminished by

in-person discussion at Sony Mobile.

“… it is much easier to work withdirect communication ratherthan with the Gerrit tools.”Software architect

✓81% of stakeholders agreed 27

Page 28: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Discouraging the practice ofself-verification

Investigating ways to encouragepassive developers to participate more

in code review

28

What is Sony Mobile doing toadjust their reviewing process?

QA has new focus ontest coverage of external code

Page 29: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Investigating ways to encouragepassive developers to participate more

in code review

29

What is Sony Mobile doing toadjust their reviewing process?

QA has new focus ontest coverage of external code

Discouraging the practice ofself-verification

Page 30: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

30in code review

What is Sony Mobile doing toadjust their reviewing process?

QA has new focus ontest coverage of external code

Discouraging the practice ofself-verification

Investigating ways to encouragepassive developers to participate more

Page 31: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

31

Page 32: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

32

Page 33: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

33

Page 34: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

34

Page 35: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

35

Page 36: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

36

Backup slides

Page 37: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

37

Review coverage of a component

✓✓

✓ ✓

✓✓

Review is performedat the Sony Mobile's Gerrit

✓✓✓✓ ✓✓✓

Page 38: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Code review participation metrics

✓✓✓

✓✓ ✓

Discussion volume recorded in Gerrit

Number of commits approved by her/his own

Self review only?Enough code review effort?

38

Page 39: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

But, again, they do NOT share relationship with defect proneness

✓✓✓

✓✓ ✓

recorded in Gerritapproved by her/his own✗Number of commits

39

✗Discussion volume

Page 40: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Adjusted review participation metrics share relationship with defect-proneness

✓✓✓

✓✓ ✓

Patch updates activity

verified by her/his own

Lax reviewing practices are associated withdefect-proneness. 40

✓Number of commits ✓

Page 41: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

41External components tend to be

In­House

more defect-prone.

Defect-proneness declines as In-House ratio increases.

Review­coverage

No significant link with defect proneness

In-House shares a stronger relationship with defect proneness at Sony Mobile

Page 42: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Self-verify shares an increasing relationship with defect proneness.

Number of­self_verify commits

Defect­­proneness

(Logit­­transformed)

42

Page 43: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Defect­­proneness

(Logit­­transformed)

Patch updates activity

Patch updates activity shares an decreasing relationship with defect proneness.

43

Page 44: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

44

Quantitative study

Replication of McIntosh et al.,

EMSE 2015

Do reviewing practices impact software quality at Sony Mobile?

Page 45: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Quantitative study

Qualitative study

with 100+ people45EMSE 2015

Replication of McIntosh et al.,

Developer surveys at Sony Mobile

Do reviewing practices impact software quality at Sony Mobile?

Page 46: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Quantitative study

Qualitative study

Replication of McIntosh et al.,

by stakeholders with 100+ people46EMSE 2015

Developer surveys at Sony Mobile

Do reviewing practices impact software quality at Sony Mobile?

Implications

Better code review practices validated

Page 47: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

47

A software project for this.

Target system: A smartphone product of a release cycle for 6 months

700 components

...300 components

...We study defect-pronenessof those 1,000 components

Page 48: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Do reviewing practices impact software quality?

RQ1:Review coverage

RQ2:Review participation

48

Page 49: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Review coverage of a component

Code repository of 1 component

1 commit

49

Page 50: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

50

Review coverage of a component

✓✓

✓ ✓

✓✓

8 commits

4 reviewed

5 commits

1 reviewed

2 commits

2 reviewed

Review is performedat the Sony Mobile's Gerrit

Page 51: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Review coverage of a component

✓✓

✓ ✓

✓✓

50% 20% 100%51

Page 52: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

However, it does NOT share relationship with defect-proneness

✓✓

✓ ✓

✓✓

✗50%52

✗20% ✗100%

Page 53: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

At Sony Mobile, review status is equivalent to whether it is made 'In-House'

✓✓

✓ ✓

Sony Mobile's internal patches

Linux kernel's baseline commits

53

Page 54: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

But, our defined bags look too small to represent 'In-House' made ratio

✓✓

✓ ✓

Commits during development of

Slipped historic kernel commits

54

Page 55: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

55

We adjusted the definition of 'review coverage'

✓✓

✓ ✓

→ ??%

Proportion of 'In-House' commits in total

Page 56: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

56

Adjusted review coverage shares relationship with defect-proneness

✓✓✓✓

✓✓✓

✓✓ ✓

✓0.1% ✓1% ✓100%External originated components tend to be

more defect prone.

Page 57: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Do reviewing practices impact software quality?

RQ1:Review coverage

✓YES!In-House ratio

RQ2:Review participation

???57

Page 58: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

58

Ok, code-reviewed but...

✓A reviewed commit

no guarantee of active participation

Page 59: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

✓Definitions of participation

Who approved this

commit?

59

Page 60: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

✓ Sufficient discussion

(effort) made?

Who approved this

commit?

60

Definitions of participation

Page 61: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

✓Code review participation metrics

Sufficient discussion

(effort) made?

Number of commits approved by her/his own

Discussion volume recorded in Gerrit

WWhohodidaapppprroovveed tthhiiss

ccoommmmiitt??

61

Page 62: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

✓ Sufficient discussion

(effort) made?

approved by her/his own✗Number of commits

recorded in Gerrit

✗Discussion volume

But, they do NOT share relationship with defect proneness

WWhohodidaapppprroovveed tthhiiss

ccoommmmiitt??

62

Page 63: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

We adjust self-approval

We only counted the number of self “Code-Review”

We also count the number of self “Verified”63

Page 64: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

Code review process atSony Mobile

Code reviewer

Programmer

1.Code.

2.Upload.

3. Review.

4.Verify on HW.

Gerrit server

5. Privileged.6. Submit.

64

Page 65: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

65

Code review system at Sony Mobile

Page 66: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

We adjust effort

“… it is much easier to work with direct communication rather than with the Gerrit tools.”

Software architect

66

No longer assume discussion is online.We introduce a new “patch update ratio”

Page 67: A Study of the Quality-Impacting Practices of Modern Code Review at Sony Mobile

✓Who verified this

commit?

Sufficient discussion

(effort) made?

verified by her/his own

✓Number of commitsactivity

67

✓Patch updates

Adjusted review participation metrics share relationship with defect-proneness