27
Do Changes Induce Fixes? On Fridays. Jacek Śliwerski, Thomas Zimmermann , Andreas Zeller Saarland University When

When do changes induce fixes?

Embed Size (px)

DESCRIPTION

Presented at MSR 2005.

Citation preview

Page 1: When do changes induce fixes?

Do Changes Induce Fixes? On Fridays.

Jacek Śliwerski, Thomas Zimmermann, Andreas ZellerSaarland University

When

Page 2: When do changes induce fixes?

The Risk of Change

Which changes go wrong?

How do we find such “bad” changes?

What can we do with them?

Idea: combine bug databases + version archives=> locate fix-inducing changes

Page 3: When do changes induce fixes?

The Risk of Change

Which changes go wrong?

How do we find such “bad” changes?

What can we do with them?

Idea: combine bug databases + version archives=> locate fix-inducing changes

Page 4: When do changes induce fixes?

Fix-Inducing Changes

Fix-Inducing Changes areChanges that lead to problems as indicated by later fixes.

Example:...if (foo==null) { foo.bar();

FIX-INDUCING

...if (foo!=null) { foo.bar();

FIX

Later:

Page 5: When do changes induce fixes?

Locate Fix-Inducing ChangesHow to

Page 6: When do changes induce fixes?

$ cvs annotate -r 1.17 Foo.java ...19: 1.11 (john 12-Feb-03): public int a() {20: 1.11 (john 12-Feb-03): return i/0; ...39: 1.10 (mary 12-Jan-03): public int b() {40: 1.14 (kate 23-May-03): return 42; ...59: 1.10 (mary 17-Jan-03): public void c() {60: 1.16 (mary 10-Jun-03): int i=0;

$ cvs annotate -r 1.17 Foo.java

Locate Fix-Inducing ChangesHow to

1.18

Fixed Bug

42233

Changed:

a() b() c()

20 40 60line

Page 7: When do changes induce fixes?

Locate Fix-Inducing Changes $ cvs annotate -r 1.17 Foo.java

20: 1.11 (john 12-Feb-03): return i/0;40: 1.14 (kate 23-May-03): return 42;60: 1.16 (mary 10-Jun-03): int i=0;

How to

1.11 1.161.14

a() was

changed

c() was

changed

b() was

changed

1.18

Fixed Bug

42233

Changed:

a() b() c()FIX-INDUCING FIX-INDUCINGFIX-INDUCING

Page 8: When do changes induce fixes?

1.11 1.161.14

a() was

changed

c() was

changed

b() was

changed

1.18

Fixed Bug

42233

Changed:

a() b() c()

Bug 42233 was reported. closed.

1.11

a() was

changed

Locate Fix-Inducing Changes $ cvs annotate -r 1.17 Foo.java

20: 1.11 (john 12-Feb-03): return i/0;40: 1.14 (kate 23-May-03): return 42;60: 1.16 (mary 10-Jun-03): int i=0;

How to

FIX-INDUCING FIX-INDUCINGFIX-INDUCINGBUG-INDUCING

Bug

Page 9: When do changes induce fixes?

Bug-Inducing Changesare Indicators for Risk

Page 10: When do changes induce fixes?

Large Transactionsare Risky

Bug-Inducing

Not Bug-Inducing

All

FixNot a Fix

All 3.52

Average Number of Changed Files

ECLIPSE, for MOZILLA the average is 3.58.

Page 11: When do changes induce fixes?

Large Transactionsare Risky

Bug-Inducing

Not Bug-Inducing

All

Fix 2.73Not a Fix 3.81

All 3.52

Average Number of Changed Files

ECLIPSE, for MOZILLA the other way round.

Page 12: When do changes induce fixes?

Large Transactionsare Risky

Bug-Inducing

Not Bug-Inducing

All

Fix 2.73Not a Fix 3.81

All 7.49 2.61 3.52

Average Number of Changed Files

ECLIPSE, for MOZILLA the same tendency.

Page 13: When do changes induce fixes?

Large Transactionsare Risky

Bug-Inducing

Not Bug-Inducing

All

Fix 3.82 2.08 2.73Not a Fix 11.30 2.77 3.81

All 7.49 2.61 3.52

Average Number of Changed Files

ECLIPSE, for MOZILLA a different distribution.

Page 14: When do changes induce fixes?

Fridays are Risky, Tuesdays are not ;-)

Sunday

Saturday

Friday

Thursday

Wednesday

Tuesday

Monday

0% 5% 10% 15% 20% 25% 30% 35% 40%

11.3%

10.4%

11.1%

12.1%

12.2%

11.7%

11.6%

18.4%

20.9%

20.0%

22.3%

24.0%

14.7%

16.9%

FixesBug-Inducing Changes

Frequency 20.9% of all changes on Tuesday are fixes, 10.4% induce bugs.

ECLIPSE

Page 15: When do changes induce fixes?

Fixes are very Risky

Sunday

Saturday

Friday

Thursday

Wednesday

Tuesday

Monday

0% 5% 10% 15% 20% 25% 30% 35% 40%

8.2%

7.1%

8.1%

8.8%

8.7%

8.4%

8.6%

25.1%

22.9%

23.3%

23.5%

23.2%

30.3%

26.4%

Fixes New Features, Refactoring

Likelihood that a Change is Bug-Inducing22.9% of all fixes on Tuesday induce bugs, only 7.1% of changes for new features do.

ECLIPSE

Page 16: When do changes induce fixes?

Is MOZILLA broken?

Fix transactions are larger than regular transactions (4.39 vs 3.05 files).

48.5% of all revisions are fixes, 41.5% induce later bugs.

A fix induces in 45.2% a later bugs,regular changes in “only” 38.1%.

Page 17: When do changes induce fixes?

Risk depends on Locations

For earthquakes and crime rates...

The same with risk of changes!

Page 18: When do changes induce fixes?

resolveClasspath()/* (non-Javadoc) * @see org.eclipse.jdt.launching.IRuntimeClasspathProvider#resolveClasspath * (org.eclipse.jdt.launching.IRuntimeClasspathEntry[], org.eclipse.debug.core.ILaunchConfiguration) */public IRuntimeClasspathEntry[] resolveClasspath(IRuntimeClasspathEntry[] entries, ILaunchConfiguration configuration) throws CoreException { List all = new ArrayList(entries.length); for (int i = 0; i < entries.length; i++) { switch (entries[i].getType()) { case IRuntimeClasspathEntry.PROJECT: // a project resolves to itself for source lookup (rather than the class file output locations) all.add(entries[i]); break; case IRuntimeClasspathEntry.OTHER: IRuntimeClasspathEntry2 entry = (IRuntimeClasspathEntry2)entries[i]; if (entry.getTypeId().equals(DefaultProjectClasspathEntry.TYPE_ID)) { // add the resolved children of the project IRuntimeClasspathEntry[] children = entry.getRuntimeClasspathEntries(configuration); IRuntimeClasspathEntry[] res = JavaRuntime.resolveSourceLookupPath(children, configuration); for (int j = 0; j < res.length; j++) { all.add(res[j]); } } break; default: IRuntimeClasspathEntry[] resolved =JavaRuntime.resolveRuntimeClasspathEntry(entries[i], configuration); for (int j = 0; j < resolved.length; j++) { all.add(resolved[j]); } break; } } return (IRuntimeClasspathEntry[])all.toArray(new IRuntimeClasspathEntry[all.size()]);}

9 changes,all of them fixes

8 bug-inducing changesone re-implementation

Page 19: When do changes induce fixes?
Page 20: When do changes induce fixes?

HATARIRaising Risk Awareness

Movie withJohn Wayne

(1962)

Swahili for “Danger”

Page 21: When do changes induce fixes?

HATARI: Annotations

Unrisky Location(green)

Risky Location(dark red)

Page 22: When do changes induce fixes?

Conclusion

Fix- and Bug-inducing changes are an measure for (past) risk.

We make this risk visible for developers.

HATARI will be released in August 2005http://www.st.cs.uni-sb.de/softevo/

Until then: Don’t program on Fridays! ;-)

Page 23: When do changes induce fixes?

Sign Gallery

Page 24: When do changes induce fixes?
Page 25: When do changes induce fixes?
Page 26: When do changes induce fixes?
Page 27: When do changes induce fixes?