HATARI: Raising Risk Awareness

Thomas Zimmermann
Thomas ZimmermannResearcher at Microsoft Research
Movie with
John Wayne
   (1962)


                                              Swahili for
                                               “Danger”

            HATARI
    Raising Risk Awareness
   Jacek Sliwerski, Thomas Zimmermann, and Andreas Zeller
                      Saarland University
What is Risk?
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)

                                                              9 changes,
       all.add(entries[i]);
       break;
      case IRuntimeClasspathEntry.OTHER:
                                                          all of them fixes
       IRuntimeClasspathEntry2 entry = (IRuntimeClasspathEntry2)entries[i];
       if (entry.getTypeId().equals(DefaultProjectClasspathEntry.TYPE_ID)) {
         // add the resolved children of the project
                                                        8 fix-inducing changes
         IRuntimeClasspathEntry[] children = entry.getRuntimeClasspathEntries(configuration);
         IRuntimeClasspathEntry[] res = JavaRuntime.resolveSourceLookupPath(children, configuration);

                                                        one re-implementation
         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()]);
}
Fix-Inducing Changes
Fix-Inducing Changes are
Changes that lead to problems as
indicated by later fixes.
                      Later:
Example:
...                   ...
if (foo==null) {      if (foo!=null) {
    foo.bar();            foo.bar();

FIX-INDUCING                   FIX
How to
Locate Fix-Inducing Changes
How to
Locate Fix-Inducing Changes
      $ 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;


                                                       1.18
                                                   Fixed Bug
                                                   42233
                                                   Changed:
                                                   a() b() c()
                                             line 20 40 60
How to
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;




   1.11                 1.14           1.16         1.18
 a() was          b() was        c() was        Fixed Bug
 changed          changed        changed        42233
                                                Changed:
FIX-INDUCING      FIX-INDUCING   FIX-INDUCING
                                                a() b() c()
How to
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;



               Bug 42233 was reported.            closed.




   1.11                  1.14            1.16               1.18
 a() was           b() was          c() was          Fixed Bug
 changed           changed          changed          42233
                                                     Changed:
FIX-INDUCING      FIX-INDUCING     FIX-INDUCING
                                                     a() b() c()
                 REMOVE FALSE POSITIVES
A Measure for Risk
           based on Fix-Inducing Changes


 risk(L) is the (past) risk for a location L

  “BAD” Changes


           # Fix-Inducing Changes to L
 risk(L) =
                 # Changes to L
How to Predict Future Risk
              0.5


              0.4


              0.3
Correlation
              0.2


              0.1


               0
                    0   1   2   3   4   5   6   7   8   9   10

                        Number of upcoming changes
How to Predict Future Risk
              0.5


                        McCabe Cyclomatic Complexity
              0.4


              0.3
Correlation
              0.2


              0.1


               0
                    0   1    2     3    4     5        6   7   8   9   10

                        Number of upcoming changes
How to Predict Future Risk
              0.5
                        Nested Block Depth
                        McCabe Cyclomatic Complexity
              0.4


              0.3
Correlation
              0.2


              0.1


               0
                    0   1    2     3    4     5        6   7   8   9   10

                        Number of upcoming changes
How to Predict Future Risk
              0.5
                        Past Risk
                        Nested Block Depth
                        McCabe Cyclomatic Complexity
              0.4


              0.3
Correlation
              0.2


              0.1


               0
                    0   1    2     3    4     5        6   7   8   9   10

                        Number of upcoming changes
Demo: HATARI
HATARI: Risky Locations
                  Granularities


                        Past Risk
Location
                         Values
HATARI: Annotations

“Safe” Location
    (green)


Risky Location
  (dark red)
HATARI: Risk History
Bug, fix, or both?
                    Change information




  Bug information
Conclusion

Fix-inducing changes are a measure for
(past) risk.
HATARI makes risk visible for developers.
HATARI will be open source (Nov 1)
http://www.st.cs.uni-sb.de/softevo/
1 of 18

More Related Content

What's hot(20)

CoffeeScriptCoffeeScript
CoffeeScript
Ryan McGeary1.3K views
JavaScript Proven PractisesJavaScript Proven Practises
JavaScript Proven Practises
Robert MacLean628 views
To Err Is HumanTo Err Is Human
To Err Is Human
Alex Liu4K views
Vaadin 7Vaadin 7
Vaadin 7
Joonas Lehtinen3.1K views
Testing My PatienceTesting My Patience
Testing My Patience
Adam Lowry2.4K views
Create a Customized GMF DnD FrameworkCreate a Customized GMF DnD Framework
Create a Customized GMF DnD Framework
Kaniska Mandal969 views
Data binding в массы! (1.2)Data binding в массы! (1.2)
Data binding в массы! (1.2)
Yurii Kotov1.1K views
node.js Module Developmentnode.js Module Development
node.js Module Development
Jay Harris3.9K views
Anton Minashkin Dagger 2 lightAnton Minashkin Dagger 2 light
Anton Minashkin Dagger 2 light
Michael Pustovit1.6K views
Kotlin GenerationKotlin Generation
Kotlin Generation
Minseo Chayabanjonglerd102 views
Akka in-actionAkka in-action
Akka in-action
Raymond Roestenburg6.6K views
The Language for future-juliaThe Language for future-julia
The Language for future-julia
岳華 杜128 views
Wait queueWait queue
Wait queue
Roy Lee2.2K views

Viewers also liked(11)

More from Thomas Zimmermann(20)

Software Analytics = Sharing InformationSoftware Analytics = Sharing Information
Software Analytics = Sharing Information
Thomas Zimmermann3.3K views
MSR 2013 PreviewMSR 2013 Preview
MSR 2013 Preview
Thomas Zimmermann21.8K views
Analytics for smarter software development Analytics for smarter software development
Analytics for smarter software development
Thomas Zimmermann2.6K views
Klingon Countdown TimerKlingon Countdown Timer
Klingon Countdown Timer
Thomas Zimmermann1.3K views
Data driven games user researchData driven games user research
Data driven games user research
Thomas Zimmermann1.5K views
Security trend analysis with CVE topic modelsSecurity trend analysis with CVE topic models
Security trend analysis with CVE topic models
Thomas Zimmermann1.5K views
Analytics for software developmentAnalytics for software development
Analytics for software development
Thomas Zimmermann4.6K views
Cross-project defect predictionCross-project defect prediction
Cross-project defect prediction
Thomas Zimmermann1.9K views
Quality of Bug Reports in Open SourceQuality of Bug Reports in Open Source
Quality of Bug Reports in Open Source
Thomas Zimmermann1.6K views
Meet Tom and his FishMeet Tom and his Fish
Meet Tom and his Fish
Thomas Zimmermann1.5K views
Got Myth? Myths in Software EngineeringGot Myth? Myths in Software Engineering
Got Myth? Myths in Software Engineering
Thomas Zimmermann5.9K views

Recently uploaded(20)

HATARI: Raising Risk Awareness

  • 1. Movie with John Wayne (1962) Swahili for “Danger” HATARI Raising Risk Awareness Jacek Sliwerski, Thomas Zimmermann, and Andreas Zeller Saarland University
  • 3. 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) 9 changes, all.add(entries[i]); break; case IRuntimeClasspathEntry.OTHER: all of them fixes IRuntimeClasspathEntry2 entry = (IRuntimeClasspathEntry2)entries[i]; if (entry.getTypeId().equals(DefaultProjectClasspathEntry.TYPE_ID)) { // add the resolved children of the project 8 fix-inducing changes IRuntimeClasspathEntry[] children = entry.getRuntimeClasspathEntries(configuration); IRuntimeClasspathEntry[] res = JavaRuntime.resolveSourceLookupPath(children, configuration); one re-implementation 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()]); }
  • 4. Fix-Inducing Changes Fix-Inducing Changes are Changes that lead to problems as indicated by later fixes. Later: Example: ... ... if (foo==null) { if (foo!=null) { foo.bar(); foo.bar(); FIX-INDUCING FIX
  • 6. How to Locate Fix-Inducing Changes $ 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; 1.18 Fixed Bug 42233 Changed: a() b() c() line 20 40 60
  • 7. How to 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; 1.11 1.14 1.16 1.18 a() was b() was c() was Fixed Bug changed changed changed 42233 Changed: FIX-INDUCING FIX-INDUCING FIX-INDUCING a() b() c()
  • 8. How to 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; Bug 42233 was reported. closed. 1.11 1.14 1.16 1.18 a() was b() was c() was Fixed Bug changed changed changed 42233 Changed: FIX-INDUCING FIX-INDUCING FIX-INDUCING a() b() c() REMOVE FALSE POSITIVES
  • 9. A Measure for Risk based on Fix-Inducing Changes risk(L) is the (past) risk for a location L “BAD” Changes # Fix-Inducing Changes to L risk(L) = # Changes to L
  • 10. How to Predict Future Risk 0.5 0.4 0.3 Correlation 0.2 0.1 0 0 1 2 3 4 5 6 7 8 9 10 Number of upcoming changes
  • 11. How to Predict Future Risk 0.5 McCabe Cyclomatic Complexity 0.4 0.3 Correlation 0.2 0.1 0 0 1 2 3 4 5 6 7 8 9 10 Number of upcoming changes
  • 12. How to Predict Future Risk 0.5 Nested Block Depth McCabe Cyclomatic Complexity 0.4 0.3 Correlation 0.2 0.1 0 0 1 2 3 4 5 6 7 8 9 10 Number of upcoming changes
  • 13. How to Predict Future Risk 0.5 Past Risk Nested Block Depth McCabe Cyclomatic Complexity 0.4 0.3 Correlation 0.2 0.1 0 0 1 2 3 4 5 6 7 8 9 10 Number of upcoming changes
  • 15. HATARI: Risky Locations Granularities Past Risk Location Values
  • 16. HATARI: Annotations “Safe” Location (green) Risky Location (dark red)
  • 17. HATARI: Risk History Bug, fix, or both? Change information Bug information
  • 18. Conclusion Fix-inducing changes are a measure for (past) risk. HATARI makes risk visible for developers. HATARI will be open source (Nov 1) http://www.st.cs.uni-sb.de/softevo/