debug concern navigator masaru shiozuka(kyushu institute of technology, japan) naoyasu...
Embed Size (px)
TRANSCRIPT

Debug Concern Navigator
Masaru Shiozuka (Kyushu Institute of Technology, Japan)Naoyasu Ubayashi (Kyushu University, Japan)Yasutaka Kamei (Kyushu University, Japan)
July 7, 2011
SEKE 2011

2
Overview-- Debug Recommendation System
dcNavi(Debug Concern Navigator)
Recommend(Code snippets)
Project and OSSRepositories
public class Property { public String readFile (String pathname) throws IOException { String val = null; File file = new File(pathname); FileReader fileReader = new FileReader(file) ; BufferedReader br = new BufferedReader(fileReader); val = br.readLine(); return val; } }
public class Property { public String readFile (String pathname) throws IOException { String val = null; File file = new File(pathname); FileReader fileReader = new FileReader(file) ; BufferedReader br = new BufferedReader(fileReader); val = br.readLine(); return val; } }
public class Property { public String readFile (String pathname) throws IOException { String val = null; File file = new File(pathname); FileReader fileReader = new FileReader(file) ; BufferedReader br = new BufferedReader(fileReader); val = br.readLine(); return val; } }
Search
Query
How to handle this exception ?How to use this API ?
Debug Concerns

3
Recommendation
Bug fix of delete method (subclipse project: revision 984)
DcNavi can provide
the code snippets before and after similar bug fixes
by searching past repositories !
Before After

4
Outline
Motivation
DCG: Debug Concern Graph
dcNavi
Evaluation
Related work
Conclusion and Future work

Motivation
5

6
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.

7
A typical debugging scenario
A novice is debugging a Java program.Situation
1) How to handle this exception ? (FileNotFoundException)
2) How to use this API usage ? (BufferedReader)3) Are other test cases needed ?4) How to review this code ?
Debug Concern
s

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

9
Our approach
•Reuse past experiences•Based on TDD (Test-Driven Development)•DCG (Debug Concern Graph)
dcNavi
Recommend(Code snippets)
Project and OSSRepositories
Search
Query
How to handle this exception ?How to use this API ?

DCG: Debug Concern Graph
10

11
DCG-- Introducing Concern Graph
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.

12
DCG-- TDD-based Graph expansion
Pan, K., et al., Toward an understanding of bug fix patterns,Empirical Software Engineering, pp.286-315, 2009.
dcNavi: Eclipse plugin Mylyn Junit
Bug Fix PatternsMC-DAP: Method Call with Different Actual ParameterSQ-AROB: Addition or Removal of Method CallsIF-CC: Change of If Condition Expression

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

dcNavi--- Debug Concern Navigator
14

15
dcNavi overview
DCG manager for supporting graph construction and evolution
DCG generator for importing existing repositories
Debug recommender
OSS

16
Recommendation result

Recommendation Algorithm
17
Obtain recommendation candidates
Obtains all past tests failing to handle the FileNotFoundException
finds the test target methods whose after-modification include the bug fix patterns
Recommend code snippets ranked by the graph similarity metric
Similarity(G1, G2) = #common_node / (#G1_node + #G2_node) / 2)
Recommendation
readLine
calls
calls
Debug readFile
Test failureexception:FileNotFound
Bug Fix Pattern
(SQ-AROB)
Start

Evaluation
18

19
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.
all revisions of other eight projects
4/5 revisions from eachproject
remaining 1/5 revisions of each project
Training data
+
Real data
Recommendation
ResultsCheck !

20
Results
Precision: 15% - 35%Recall: 20% - 50%

Related work
21

22
Related work
DebugAdvisor [Ashok, B. FSE2009] 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.
FixWizard [Nquyen, T. T. ICSE2010] A support tool for identifying the code peers existing in
the program and recommend the similar fixes to its peers.
We focus onDebug Concerns and Bug Fix Patterns.

Conclusion and Future work
23

24
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

25
Thank you for your attention.