72
Investigating Code Review Practices in Defective Files Patanamon (Pick) Thongtanunam Shane McIntosh Ahmed E. Hassan Hajimu Iida May 16-17, 2015. Firenze, Italy [email protected] @pamon

Investigating Code Review Practices in Defective Files

Embed Size (px)

Citation preview

Page 1: Investigating Code Review Practices in Defective Files

Investigating Code Review Practices in Defective Files

Patanamon (Pick) Thongtanunam

Shane McIntosh Ahmed E. Hassan Hajimu Iida

May 16-17, 2015. Firenze, Italy

[email protected] @pamon

Page 2: Investigating Code Review Practices in Defective Files

Modern Code Review: A lightweight, tool-supported code review process

Code Review Tool

Page 3: Investigating Code Review Practices in Defective Files

Modern Code Review: A lightweight, tool-supported code review process

Code Review Tool

Code change

Page 4: Investigating Code Review Practices in Defective Files

Modern Code Review: A lightweight, tool-supported code review process

Code Review Tool

Code change

Page 5: Investigating Code Review Practices in Defective Files

Modern Code Review: A lightweight, tool-supported code review process

Code Review Tool

Code change

Examine Code

Page 6: Investigating Code Review Practices in Defective Files

Modern Code Review: A lightweight, tool-supported code review process

Upstream VCS repositories

Code Review Tool

Code change

Examine Code

Page 7: Investigating Code Review Practices in Defective Files

Modern Code Review: A lightweight, tool-supported code review process

Upstream VCS repositories

Code changeA lack of code review activity can increase the

risk of post-release defects [McIntosh et. al., MSR2014]

My code is awesome! No needs for a review

Code Review Tool

Code change

Examine Code

Page 8: Investigating Code Review Practices in Defective Files

Modern Code Review: A lightweight, tool-supported code review process

Upstream VCS repositories

Code changeA lack of code review activity can increase the

risk of post-release defects [McIntosh et. al., MSR2014]

My code is awesome! No needs for a review

Code Review Tool

Code change

How should reviewers do a code review to reduce the risk of

having defects?

Examine Code

Page 9: Investigating Code Review Practices in Defective Files

What is the difference between code review practices of defective and clean files?

Page 10: Investigating Code Review Practices in Defective Files

What is the difference between code review practices of defective and clean files?

Review Practice A

Defective i.e., files that have defects

Page 11: Investigating Code Review Practices in Defective Files

Defect-free (Clean) i.e., files that do not have defects

Review Practice B

What is the difference between code review practices of defective and clean files?

Review Practice AVS

Defective i.e., files that have defects

Page 12: Investigating Code Review Practices in Defective Files

Defect-free (Clean) i.e., files that do not have defects

Review Practice B

What is the difference between code review practices of defective and clean files?

Review Practice AVS

Defective i.e., files that have defects

Page 13: Investigating Code Review Practices in Defective Files

We measure 3 dimensions of review activity metrics

Review Intensity e.g., #Review Iterations,

Discussion Length

Review Participation e.g., #Reviewers,

Review Agreement

Reviewing Time e.g., Review Length, Code Reading Speed

Page 14: Investigating Code Review Practices in Defective Files

Defect-free (Clean) i.e., files that do not have defects

Review Practice B

What is the difference between code review practices of defective and clean files?

Review Practice AVS

Defective i.e., files that have defects

Page 15: Investigating Code Review Practices in Defective Files

Defect-free (Clean) i.e., files that do not have defects

Review Practice B

What is the difference between code review practices of defective and clean files?

Review Practice AVS

Defective i.e., files that have defects

Page 16: Investigating Code Review Practices in Defective Files

Defective i.e., files that have defects

We investigate defective files along 2 perspectives

Page 17: Investigating Code Review Practices in Defective Files

Defective i.e., files that have defects

We investigate defective files along 2 perspectives

Page 18: Investigating Code Review Practices in Defective Files

Risky Files

Files that have historically been defective

Past Defective i.e., files that have defects

We investigate defective files along 2 perspectives

Page 19: Investigating Code Review Practices in Defective Files

Risky Files

Files that have historically been defective

Past FutureDefective i.e., files that have defects

Future-Defective Files

Files that will eventually have defects

We investigate defective files along 2 perspectives

Page 20: Investigating Code Review Practices in Defective Files

Risky Files

Files that have historically been defective

Past FutureDefective i.e., files that have defectsFuture-Defective Files

Files that will eventually have defects

Conjecture: Reviews of Future-Defective will be

• less intense, • with less team participation, • completed with a shorter time than reviews of clean files

We investigate defective files along 2 perspectives

Page 21: Investigating Code Review Practices in Defective Files

Future-Defective Files: Files that have post-release defects

VCS Repositories

Page 22: Investigating Code Review Practices in Defective Files

Future-Defective Files: Files that have post-release defects

VCS Repositories

Release date Bug-fixing commit

Page 23: Investigating Code Review Practices in Defective Files

Future-Defective Files: Files that have post-release defects

VCS Repositories

Release date Bug-fixing commitFuture-Defective

Page 24: Investigating Code Review Practices in Defective Files

Future-Defective Files: Files that have post-release defects

VCS Repositories

Release date

No bug-fixing commits

Release date

Bug-fixing commitFuture-Defective

Page 25: Investigating Code Review Practices in Defective Files

Future-Defective Files: Files that have post-release defects

VCS Repositories

Release date

No bug-fixing commits

Release date

Bug-fixing commitFuture-Defective

Clean

Page 26: Investigating Code Review Practices in Defective Files

Future-Defective Files: Files that have post-release defects

Studied ReviewsVCS Repositories

Release date

No bug-fixing commits

Release date

Bug-fixing commit

6 months

Future-Defective

Clean

Page 27: Investigating Code Review Practices in Defective Files

Future-Defective Files: Files that have post-release defects

Studied ReviewsVCS Repositories

Release date

No bug-fixing commits

Release date

Bug-fixing commit

6 months

1,176 Files 3,470 Reviews

10,513 Files 2,727 Reviews

5.0.0

866 Files 2,849 Reviews

11,931 Files 2,690 Reviews

5.1.0

Future-Defective

Clean

Page 28: Investigating Code Review Practices in Defective Files

#Reviewers

#Reviews of Clean files

#Reviewers

#Reviews of Future-Defective files

VS

Review Activity Analysis: Compare code review activity that has been applied to future-defective and clean files

Page 29: Investigating Code Review Practices in Defective Files

#Reviewers

#Reviews of Clean files

#Reviewers

#Reviews of Future-Defective files

VS

Using a statistical test to determine the difference between the distributions of code review activity

Review Activity Analysis: Compare code review activity that has been applied to future-defective and clean files

Page 30: Investigating Code Review Practices in Defective Files

#Reviewers

#Reviews of Clean files

#Reviewers

#Reviews of Future-Defective files

VS

Using a statistical test to determine the difference between the distributions of code review activity

Raw code review activity metric is normalized by patch size

Review Activity Analysis: Compare code review activity that has been applied to future-defective and clean files

Page 31: Investigating Code Review Practices in Defective Files

Findings

Code review activity in the reviews of future-defective files

Conjecture

Results

Review Intensity

Review Participation

Reviewing Time

Less Intense

Less Team Participation

Completed with a shorter time

Page 32: Investigating Code Review Practices in Defective Files

Findings

Code review activity in the reviews of future-defective files

Conjecture

Less Intense

Results

Review Intensity

Review Participation

Reviewing Time

Less Intense

Less Team Participation

Completed with a shorter time

Page 33: Investigating Code Review Practices in Defective Files

Findings

Code review activity in the reviews of future-defective files

Conjecture

Less Intense

Less Team Participation

Results

Review Intensity

Review Participation

Reviewing Time

Less Intense

Less Team Participation

Completed with a shorter time

Page 34: Investigating Code Review Practices in Defective Files

Findings

Code review activity in the reviews of future-defective files

Conjecture

Less Intense

Less Team Participation

Faster Code Reading Rate

Results

Review Intensity

Review Participation

Reviewing Time

Less Intense

Less Team Participation

Completed with a shorter time

Page 35: Investigating Code Review Practices in Defective Files

Defective i.e., files that have defects

Past

We investigate defective files along 2 perspectives

Risky Files

Files that have historically been defective

FutureFuture-Defective Files

Files that will eventually have defects

Conjecture: Reviews of Future-Defective will be

• less intense, • with less team participation, • completed with a shorter time than reviews of clean files

Page 36: Investigating Code Review Practices in Defective Files

Defective i.e., files that have defects

Past

We investigate defective files along 2 perspectives

Risky Files

Files that have historically been defective

FutureFuture-Defective Files

Files that will eventually have defects

Reviews of future-defective files tend to be less rigorous than

reviews of clean files

Page 37: Investigating Code Review Practices in Defective Files

Defective i.e., files that have defects

Past

We investigate defective files along 2 perspectives

Risky Files

Files that have historically been defective

FutureFuture-Defective Files

Files that will eventually have defects

Reviews of future-defective files tend to be less rigorous than

reviews of clean files

Page 38: Investigating Code Review Practices in Defective Files

Defective i.e., files that have defects

Past

We investigate defective files along 2 perspectives

Risky Files

Files that have historically been defective

Conjecture: Reviews of risky files should be

• more intense, • with more team participation, • reviewed for a longer time

to reduce the risk of having defects in the future

FutureFuture-Defective Files

Files that will eventually have defects

Reviews of future-defective files tend to be less rigorous than

reviews of clean files

Page 39: Investigating Code Review Practices in Defective Files

Risky Files: Files that had post-release defects in prior release

VCS Repositories

Page 40: Investigating Code Review Practices in Defective Files

Risky Files: Files that had post-release defects in prior release

VCS Repositories

Release datePrior release date

Bug-fixing commit

Page 41: Investigating Code Review Practices in Defective Files

Risky Files: Files that had post-release defects in prior release

VCS Repositories

Release datePrior release date

Bug-fixing commit

Risky

Page 42: Investigating Code Review Practices in Defective Files

Risky Files: Files that had post-release defects in prior release

VCS Repositories

No bug-fixing commits

Release datePrior release date

Release datePrior release date

Bug-fixing commit

Risky

Page 43: Investigating Code Review Practices in Defective Files

Risky Files: Files that had post-release defects in prior release

VCS Repositories

No bug-fixing commits

Release datePrior release date

Release datePrior release date

Bug-fixing commit

Normal

Risky

Page 44: Investigating Code Review Practices in Defective Files

Risky Files: Files that had post-release defects in prior release

Studied ReviewsVCS Repositories

No bug-fixing commits

Release datePrior release date

Release datePrior release date

Bug-fixing commit

6 months

Normal

Risky

Page 45: Investigating Code Review Practices in Defective Files

Risky Files: Files that had post-release defects in prior release

Studied ReviewsVCS Repositories

No bug-fixing commits

Release datePrior release date

Release datePrior release date

Bug-fixing commit

6 months

1,168 Files 2,671 Reviews

11,629 Files 2,868 Reviews

5.1.0

Normal

Risky

Page 46: Investigating Code Review Practices in Defective Files

Findings

Code review activity in the reviews of risky files

Conjecture

Results

Review Intensity

Review Participation

Reviewing Time

More Intense

More Team Participation

Completed with a longer time

Page 47: Investigating Code Review Practices in Defective Files

Findings

Code review activity in the reviews of risky files

Conjecture

Less Intense

Results

Review Intensity

Review Participation

Reviewing Time

More Intense

More Team Participation

Completed with a longer time

Page 48: Investigating Code Review Practices in Defective Files

Findings

Code review activity in the reviews of risky files

Conjecture

Less Intense

Less Team Participation

Results

Review Intensity

Review Participation

Reviewing Time

More Intense

More Team Participation

Completed with a longer time

Page 49: Investigating Code Review Practices in Defective Files

Findings

Code review activity in the reviews of risky files

Conjecture

Less Intense

Less Team Participation

Receive Slow Feedback & Faster Code Reading Rate

Results

Review Intensity

Review Participation

Reviewing Time

More Intense

More Team Participation

Completed with a longer time

Page 50: Investigating Code Review Practices in Defective Files

Defective i.e., files that have defects

Past

We investigate defective files along 2 perspectives

FutureFuture-Defective Files

Files that will eventually have defects

Reviews of future-defective files tend to be less rigorous than

reviews of clean files

Risky Files

Files that have historically been defective

Conjecture: Reviews of risky files should be

• more intense, • with more team participation, • reviewed for a longer time

to reduce the risk of having defects in the future

Page 51: Investigating Code Review Practices in Defective Files

Defective i.e., files that have defects

Past

We investigate defective files along 2 perspectives

FutureFuture-Defective Files

Files that will eventually have defects

Reviews of future-defective files tend to be less rigorous than

reviews of clean files

Risky Files

Files that have historically been defective

Developers are not as careful when they review risky files.

Page 52: Investigating Code Review Practices in Defective Files

Defective i.e., files that have defects

Past

We investigate defective files along 2 perspectives

FutureReviews of future-defective files tend to be less rigorous than

reviews of clean files

Developers are not as careful when they review risky files.

Future-Defective Files

Files that will eventually have defects

Risky Files

Files that have historically been defective

Page 53: Investigating Code Review Practices in Defective Files

Defective i.e., files that have defects

Past

We investigate defective files along 2 perspectives

FutureReviews of future-defective files tend to be less rigorous than

reviews of clean files

Developers are not as careful when they review risky files.

Future-Defective Files

Files that will eventually have defects

Risky Files

Files that have historically been defective

Will careless reviews of risky files lead to future defects?

Page 54: Investigating Code Review Practices in Defective Files

Defective i.e., files that have defects

Past

We investigate defective files along 2 perspectives

FutureReviews of future-defective files tend to be less rigorous than

reviews of clean files

Developers are not as careful when they review risky files.

Future-Defective Files

Files that will eventually have defects

Risky Files

Files that have historically been defective

Will careless reviews of risky files lead to future defects?

Investigating code review practice in risky & future-

defective files

Page 55: Investigating Code Review Practices in Defective Files

Risky & Future-Defective Files: Risky files that will eventually have defects

VCS Repositories

Page 56: Investigating Code Review Practices in Defective Files

Risky & Future-Defective Files: Risky files that will eventually have defects

VCS Repositories

Bug-fixing commit

Release datePrior release date

Bug-fixing commit

Page 57: Investigating Code Review Practices in Defective Files

Risky & Future-Defective Files: Risky files that will eventually have defects

VCS Repositories

Bug-fixing commit

Release datePrior release date

Bug-fixing commit

Risky & Future-Defective

Page 58: Investigating Code Review Practices in Defective Files

Risky & Future-Defective Files: Risky files that will eventually have defects

VCS Repositories

Bug-fixing commit

Release datePrior release date

Bug-fixing commit

No bug-fixing commits

Release datePrior release date

Bug-fixing commit

Risky & Future-Defective

Page 59: Investigating Code Review Practices in Defective Files

Risky & Future-Defective Files: Risky files that will eventually have defects

VCS Repositories

Bug-fixing commit

Release datePrior release date

Bug-fixing commit

No bug-fixing commits

Release datePrior release date

Bug-fixing commit

Risky & Clean

Risky & Future-Defective

Page 60: Investigating Code Review Practices in Defective Files

Risky & Future-Defective Files: Risky files that will eventually have defects

Studied ReviewsVCS Repositories

Bug-fixing commit

Release datePrior release date

Bug-fixing commit

No bug-fixing commits

Release datePrior release date

Bug-fixing commit 6 months

Risky & Clean

Risky & Future-Defective

Page 61: Investigating Code Review Practices in Defective Files

Risky & Future-Defective Files: Risky files that will eventually have defects

Studied ReviewsVCS Repositories

Bug-fixing commit

Release datePrior release date

Bug-fixing commit

No bug-fixing commits

Release datePrior release date

Bug-fixing commit 6 months

206 Files 1,299 Reviews

962 Files 1,372 Reviews

5.1.0

Risky & Clean

Risky & Future-Defective

Page 62: Investigating Code Review Practices in Defective Files

Findings

Code review activity in the reviews of risky & future-defective files

Conjecture

Less Intense

Less Team Participation

Receive Slow Feedback & Faster Code Reading Rate

Results

Review Intensity

Review Participation

Reviewing Time

Less Intense

Less Team Participation

Completed with a shorter time

Page 63: Investigating Code Review Practices in Defective Files

Defective i.e., files that have defects

Past

We investigate defective files along 2 perspectives

FutureReviews of future-defective files tend to be less rigorous than

reviews of clean files

Developers are not as careful when they review risky files.

Future-Defective Files

Files that will eventually have defects

Risky Files

Files that have historically been defective

Will careless reviews of risky files lead to future defects?

Investigating code review practice in risky & future-

defective files

Page 64: Investigating Code Review Practices in Defective Files

Defective i.e., files that have defects

Past

We investigate defective files along 2 perspectives

FutureReviews of future-defective files tend to be less rigorous than

reviews of clean files

Developers are not as careful when they review risky files.

Future-Defective Files

Files that will eventually have defects

Risky Files

Files that have historically been defective

Reviews of files that are both risky & future defective are less rigorous than files that are risky but clean

Page 65: Investigating Code Review Practices in Defective Files

Evolvability e.g., Fixing code comments,

Decomposing complex function

Functionality e.g., Fixing incorrect

program logic

Traceability e.g., Updating commit

message

We compare concerns that are addressed during reviews of defective and clean files

Page 66: Investigating Code Review Practices in Defective Files

Evolvability

Functionality Traceability

Proportion of reviews in future-defective files in Qt5.0.0

82%

40%40%

Reviews of defective files often address evolvability concernsResults

10% higher than clean files

5% higher than clean files

10% lower than clean files

We observe the similar results for the reviews of risky files and risky & future-defective files

Page 67: Investigating Code Review Practices in Defective Files
Page 68: Investigating Code Review Practices in Defective Files

Modern Code Review: A lightweight, tool-supported code review process

Upstream VCS repositories

Code changeA lack of code review

activity can increase the

risk of post-release defects [McIntosh et. al., MSR2014]

My code is awesome! No needs for a review

Code Review Tool

Code change

How should reviewers do a code review to reduce the risk of

having defects?

Examine Code

Page 69: Investigating Code Review Practices in Defective Files

Modern Code Review: A lightweight, tool-supported code review process

Upstream VCS repositories

Code changeA lack of code review

activity can increase the

risk of post-release defects [McIntosh et. al., MSR2014]

My code is awesome! No needs for a review

Code Review Tool

Code change

How should reviewers do a code review to reduce the risk of

having defects?

Examine Code

Defect-free (Clean) i.e., files that do not have defects

Review Practice B

What is the difference between code review practices of defective and clean files?

Review Practice AVS

Defective i.e., files that have defects

Page 70: Investigating Code Review Practices in Defective Files

Modern Code Review: A lightweight, tool-supported code review process

Upstream VCS repositories

Code changeA lack of code review

activity can increase the

risk of post-release defects [McIntosh et. al., MSR2014]

My code is awesome! No needs for a review

Code Review Tool

Code change

How should reviewers do a code review to reduce the risk of

having defects?

Examine Code

Defect-free (Clean) i.e., files that do not have defects

Review Practice B

What is the difference between code review practices of defective and clean files?

Review Practice AVS

Defective i.e., files that have defects

We measure 3 dimensions of review activity metrics

Review Intensity e.g., #Review Iterations,

Discussion Length

Review Participation e.g., #Reviewers,

Review Agreement

Reviewing Time e.g., Review Length, Code Reading Speed

Page 71: Investigating Code Review Practices in Defective Files

Modern Code Review: A lightweight, tool-supported code review process

Upstream VCS repositories

Code changeA lack of code review

activity can increase the

risk of post-release defects [McIntosh et. al., MSR2014]

My code is awesome! No needs for a review

Code Review Tool

Code change

How should reviewers do a code review to reduce the risk of

having defects?

Examine Code

Defect-free (Clean) i.e., files that do not have defects

Review Practice B

What is the difference between code review practices of defective and clean files?

Review Practice AVS

Defective i.e., files that have defects

We measure 3 dimensions of review activity metrics

Review Intensity e.g., #Review Iterations,

Discussion Length

Review Participation e.g., #Reviewers,

Review Agreement

Reviewing Time e.g., Review Length, Code Reading Speed

Defective i.e., files that have defects

Past

We investigate defective files along 2 perspectives

Future

Reviews of future-defective files tend to be less rigorous than

reviews of clean files

Developers are not as careful when they review risky files.

Future-Defective Files

Files that will eventually have defects

Risky Files

Files that have historically been defective

Reviews of files that are both risky & future defective are less rigorous than files that are risky but clean

Page 72: Investigating Code Review Practices in Defective Files

Defect-free (Clean) i.e., files that do not have defects

Review Practice B

What is the difference between code review practices of defective and clean files?

Review Practice AVS

Defective i.e., files that have defects

We measure 3 dimensions of review activity metrics

Review Intensity e.g., #Review Iterations,

Discussion Length

Review Participation e.g., #Reviewers,

Review Agreement

Reviewing Time e.g., Review Length, Code Reading Speed

Defective i.e., files that have defects

Past

We investigate defective files along 2 perspectives

Future

Reviews of future-defective files tend to be less rigorous than

reviews of clean files

Developers are not as careful when they review risky files.

Future-Defective Files

Files that will eventually have defects

Risky Files

Files that have historically been defective

Reviews of files that are both risky & future defective are less rigorous than files that are risky but [email protected] @pamon

Investigating Code Review Practices in Defective FilesModern Code Review: A lightweight, tool-supported

code review process

Upstream VCS repositories

Code changeA lack of code review

activity can increase the

risk of post-release defects [McIntosh et. al., MSR2014]

My code is awesome! No needs for a review

Code Review Tool

Code change

How should reviewers do a code review to reduce the risk of

having defects?

Examine Code