debug concern navigator masaru shiozuka(kyushu institute of technology, japan) naoyasu...

of 25 /25
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

Upload: vanessa-dickerson

Post on 03-Jan-2016

220 views

Category:

Documents


0 download

Embed Size (px)

TRANSCRIPT

Page 1: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

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

Page 2: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

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

Page 3: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

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

Page 4: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

4

Outline

Motivation

DCG: Debug Concern Graph

dcNavi

Evaluation

Related work

Conclusion and Future work

Page 5: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

Motivation

5

Page 6: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

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.

Page 7: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

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

Page 8: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

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

Page 9: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

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 ?

Page 10: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

DCG: Debug Concern Graph

10

Page 11: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

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.

Page 12: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

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

Page 13: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

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

Page 14: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

dcNavi--- Debug Concern Navigator

14

Page 15: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

15

dcNavi overview

DCG manager for supporting graph construction and evolution

DCG generator for importing existing repositories

Debug recommender

OSS

Page 16: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

16

Recommendation result

Page 17: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

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

Page 18: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

Evaluation

18

Page 19: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

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 !

Page 20: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

20

Results

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

Page 21: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

Related work

21

Page 22: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

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.

Page 23: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

Conclusion and Future work

23

Page 24: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

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

Page 25: Debug Concern Navigator Masaru Shiozuka(Kyushu Institute of Technology, Japan) Naoyasu Ubayashi(Kyushu University, Japan) Yasutaka Kamei(Kyushu University,

25

Thank you for your attention.