SEKE 2011 Debug Concern Navigator Masaru Shiozuka Naoyasu
SEKE 2011 Debug Concern Navigator Masaru Shiozuka Naoyasu Ubayashi Yasutaka Kamei (Kyushu Institute of Technology, Japan) (Kyushu University, Japan) July 7, 2011
Overview -- Debug Recommendation System Debug Concerns How to handle this exception ? How to use this API ? Query dc. Navi (Debug Concern Navigator) public class Property { public String read. File (Stringpublic pathname) class throws Property { IOException { String read. File public String valpathname) = null; (String throws File file =public new {class Property { IOException public File(pathname); String val =String null; read. File (String throws File. Reader file. Reader File file = pathname) new = new File. Reader(file) IOException ; { File(pathname); Buffered. Reader brfile. Reader =val = null; String File. Reader = new File. Reader(file) File file =; new Buffered. Reader(file. Reader); File(pathname); Buffered. Reader br = val = br. read. Line(); File. Reader file. Reader = new return val; new File. Reader(file) ; Buffered. Reader(file. Reader); }} Buffered. Reader br = val = br. read. Line(); new val; return Buffered. Reader(file. Reader); }} val = br. read. Line(); return val; }} Recommend (Code snippets) Search Project and OSS Repositories 2
Recommendation Before After Bug fix of delete method (subclipse project: revision 984) Dc. Navi can provide the code snippets before and after similar bug fixes by searching past repositories ! 3
Outline Motivation DCG: Debug Concern Graph dc. Navi Evaluation Related work Conclusion and Future work 4
Motivation 5
Motivation Programmers tend to spend a lot of time debugging code. They check the erroneous phenomena, navigate the code, search the past bug fixes, and modify the code. If a sequence of these debug activities can be automated, programmers can use their time for more creative tasks. 6
A typical debugging scenario Situation A novice is debugging a Java program. Debug Concerns 1) 2) 3) 4) How to handle this exception ? (File. Not. Found. Exception) How to use this API usage ? (Buffered. Reader) Are other test cases needed ? How to review this code ? 7
Problem It is not easy for a novice to use program exceptions or test failures as a hint for fixing a bug. A programmer with a long career may be faced with the similar difficulties when the programmer works for unfamiliar new projects, languages, and frameworks. 8
Our approach How to handle this exception ? How to use this API ? dc. Navi Query Recommend (Code snippets) Search Project and OSS Repositories • Reuse past experiences • Based on TDD (Test-Driven Development) • DCG (Debug Concern Graph) 9
DCG: Debug Concern Graph 10
DCG -- Introducing Concern Graph helps programmers identify and reason about concerns in programming and makes explicit the relationships among concerns. DCG appends a set of debugging information such as bug fixes, test results, and bug fix patterns to a concern graph. Robillard, M. P. and Murphy, G. C. , Concern Graphs: Finding and Describing Concerns Using Structural Program Dependencies, ICSE 2002, pp. 406 -416, 2002. 11
DCG -- TDD-based Graph expansion dc. Navi: Eclipse plugin Mylyn MC-DAP: Junit Bug Fix Patterns SQ-AROB: IF-CC: Method Call with Different Actual Parameter Addition or Removal of Method Calls Change of If Condition Expression Pan, K. , et al. , Toward an understanding of bug fix patterns, Empirical Software Engineering, pp. 286 -315, 2009. 12
Bug fix patterns The bug fix patterns show not only how to fix bugs but also the reasons of the bugs. Many bug fixes can be categorized into the patterns. The advice can be generated from actual code snippets annotated with the bug reasons (bug fix patterns). 13
dc. Navi --- Debug Concern Navigator 14
dc. Navi overview DCG manager for supporting graph construction and evolution DCG generator for importing existing repositories Debug recommender OSS 15
Recommendation result 16
Recommendation Algorithm Debug read. File Obtain recommendation candidates Obtains all past tests failing to handle the File. Not. Found. Exception finds the test target methods whose after-modification include the bug fix patterns Recommend code snippets ranked by the graph similarity metric Start Test failure exception: File. Not. Found Recommendation calls read. Line calls Bug Fix Pattern (SQ-AROB) Similarity(G 1, G 2) = #common_node / (#G 1_node + #G 2_node) / 2) 17
Evaluation 18
Experiment Evaluation data Nine Eclipse plug-in projects (Mylyn) Criteria Bug fix pattern applied to the real debugging is the same as that of recommendation. Training data + 4/5 revisions from each project Recommendation Results all revisions of other eight projects Check ! Real data remaining 1/5 revisions of each project 19
Results Precision: 15% - 35% Recall: 20% - 50% 20
Related work 21
Related work Debug. Advisor [Ashok, B. FSE 2009] A search tool for allowing programmers to express the context of the bugs and search through diverse data such as natural language text and core dumps. Fix. Wizard [Nquyen, T. T. ICSE 2010] A support tool for identifying the code peers existing in the program and recommend the similar fixes to its peers. We focus on Debug Concerns and Bug Fix Patterns. 22
Conclusion and Future work 23
Conclusion and Future work We proposed a debug recommendation system based on Concern Graphs and Bug fix patterns. Future work Portfolio-based recommendation Support for execution trace 24
Thank you for your attention. 25
- Slides: 25