2006/09/19AOAsia 21 Towards Locating a Functional Concern Based on a Program Slicing Technique...
-
Upload
milton-fox -
Category
Documents
-
view
217 -
download
0
Transcript of 2006/09/19AOAsia 21 Towards Locating a Functional Concern Based on a Program Slicing Technique...
2006/09/19 AOAsia 2 1
Towards Locating a Functional Concern Based on a Program Slicing Technique
Takashi Ishio1,2, Ryusuke Niitani2 and Katsuro Inoue2
1University of British Columbia2Osaka University
2006/09/19 AOAsia 2 2
Abstract
Software includes many functional concerns. A functional concern is often implemented by
collaborative software modules. To understand a functional concern, you need to …
Identify clue program elements Find related modules Understand how the modules collaborate
We propose a heuristic approach to automatically extract and show the modules and their collaboration.
costly
2006/09/19 AOAsia 2 3
Program Slicing
An automatic technique to extract relevant statements and relations
1. A program P is converted to a program dependence graph. vertices: statements in P edges: control/data dependence relations
2. You specify a slicing criterion <s,v> in P. s: a statement v: a variable defined or used at s
3. You get statements that affect or depend on v by graph traversal.
1 i = 3;2 if (a > 0) {3 print i;4 }
data dependence
<3,i>
controldependence
use
definition
2006/09/19 AOAsia 2 4
Issue of Using Program Slicing
Slicing often results too many statements. main(), crosscutting concerns, …
If you calculate a program slice for , slicing extracts .
Main.main(args)App.run()Menu.onClick(buttonID)
FileDialog.getPath()Document.open(path)File.read(path)MDI.add(document)Log.debug(message)
App.quit()FileDialog.getPath()Document.save(path)File.write(path)
dependencecontrol flowconcern (open document)slicing result
2006/09/19 AOAsia 2 5
Our Method (1/2)
To extract closely related statements, we terminate the graph traversal at the appropriate vertices.
A barrier [1] is a vertex that terminates the traversal. The original barrier is set manually.
Main.main(args)App.run()Menu.onClick(buttonID)
FileDialog.getPath()Document.open(path)File.read(path)MDI.add(document)Log.debug(message)
App.quit()FileDialog.getPath()Document.save(path)File.write(path)
dependencecontrol flowconcern (open document)slicing resultbarrier
[1] Krinke, J.: Slicing, Chopping, and Path Conditions with Barriers.Software Quality Journal, Vol.12, No.4, pp.339-360,December 2004.
2006/09/19 AOAsia 2 6
Our Method (2/2)
Automatically identify appropriate barriers use heuristics
Extract a small subset of conservative slice Closely related to criteria
Conservative Slicing Our Method
dependencespecified criterionconcern relatedresultbarrier
automatically foundBarriers
2006/09/19 AOAsia 2 7
Extracting a Functional Concernwith Slicing1. Convert source code to a program dependence
graph
2. Specify one or more methods or fields of interest to you
Inputs are converted to vertices
3. Extract related statements
i. Identify primary vertices
ii. Identify barriers with heuristics
iii. Slice using the result of i. and ii.
4. Visualize the result of 3.
2006/09/19 AOAsia 2 8
3.i.Identifying “primary vertices”
Specified vertices= Your inputs
dominator
post-dominator
primary vertices
The vertices in which a barrier is not set to avoid terminating important traversals
The vertices in the paths from dominator to post-dominator dominator: the nearest common ancestor reachable
to all specified vertices post-dominator: the nearest common successor
reachable from all specified vertices
2006/09/19 AOAsia 2 9
3.ii.Identifying Barriers with Heuristics A field access
pass data from one concern to another A method entry point with no arguments
Its behavior is independent of the caller method.
An abstract method entry point Its behavior is defined at the interface level.
Library e.g. classes in java and javax package
2006/09/19 AOAsia 2 10
3.iii.Slicing A backward/forward traversal from criteria
The traversal is terminated at barriers.
dominator / post-dominatorspecified criterionbarrieradded by slicing
primary vertices slicing result
2006/09/19 AOAsia 2 11
Preliminary Case Study
Aim: estimate the effectiveness of our approach Target Program: Duplicated File Checker
Java / 1331 LOC / 14 files Overview
main() → read arguments → begin file checking → notify → output → (end file checking)
Target Concern: “notify” Input: 3 methods
notifyProgressValue, notifyErrorFile, notifyFinished
2006/09/19 AOAsia 2 12
Results: size
Small subset (less than 1/4 about LOC)
Heuristic slice:
Checker, FileList, FileMD5 and CheckerListener classes
(Non-heuristic slice) – (Heuristic slice):
Main, MainWindow and classes for GUI
Size of slices
Extracted classes
2006/09/19 AOAsia 2 13
Result: extracted slice(as a concern graph) “Notify” concern is
extracted appropriately. No weakly related
method (e.g. main())
Extracted slice (as a concern graph)
criterion
2006/09/19 AOAsia 2 14
Summary and Future Work
We proposed an approach to extract the collaborative modules implementing a functional concern. We introduced heuristics into slicing.
Future Work Develop a fully automated analysis tool Apply various heuristics
e.g. a high fan-in method Apply to large-scale software