1. ` BugCache Predicting Defects Sung Kim • MIT Tom Zimmermann • Saarland University Jim Whitehead • UC Santa Cruz Andreas Zeller • Saarland University
2. The Problem How should we allocate our resources for quality assurance? Which files should we focus on?
4. Where are bugs? Temporal locality: Defected files are likely to have more soon. [Ostrand, Weyuker] Spatial locality: In nearby other bugs! [Zimmermann et al.] In modified files! [Nagappan et al.] In new files! [Graves et al.]
5.
6. Bug Cache 10% files most defect-prone all files pre-fetch replacement Near by: co changes load
7.
8. Bug Cache load if missed load if missed pre-fetch A Fix change Non-fix change Fix change Change history B C
11. Cache Model Hit Miss Miss Cache size: 2 Block size: 2 Hit A B C A D C B B A C A B Which one should be replaced?
12.
13. Cache Model Hit Miss Miss Cache size: 2 Block size: 2 Hit Replacement: BUG A B C A D C B B A C A B Block size: 1 Cache size: 2 File LRU CHANGE BUG -5 2 2 -3 3 1 B C BUG 2 1 (replace)
14.
15. Cache Model Hit Miss Miss Cache size: 2 Block size: 2 Replacement: BUG Pre-fetch size: 1 A B C A D C B B A C A B Hit rate = #Hits / #Defects = 25% Pre-fill Pre-fetch Miss D Pre-fetch
26. ` BugCache Predicting Defects Sung Kim • MIT Tom Zimmermann • Saarland University Jim Whitehead • UC Santa Cruz Andreas Zeller • Saarland University
27. Changes that lead to problems as indicated by later fixes. Bug-introducing Changes ... if (foo!=null) { foo.bar(); ... FIX ... if (foo==null) { foo.bar(); ... BUG-INTRODUCING later fixed