Presentation is loading. Please wait.

Presentation is loading. Please wait.

2006/09/19AOAsia 21 Towards Locating a Functional Concern Based on a Program Slicing Technique Takashi Ishio 1,2, Ryusuke Niitani 2 and Katsuro Inoue 2.

Similar presentations


Presentation on theme: "2006/09/19AOAsia 21 Towards Locating a Functional Concern Based on a Program Slicing Technique Takashi Ishio 1,2, Ryusuke Niitani 2 and Katsuro Inoue 2."— Presentation transcript:

1 2006/09/19AOAsia 21 Towards Locating a Functional Concern Based on a Program Slicing Technique Takashi Ishio 1,2, Ryusuke Niitani 2 and Katsuro Inoue 2 1 University of British Columbia 2 Osaka University

2 2006/09/19AOAsia 22 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

3 2006/09/19AOAsia 23 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 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. 1i = 3; 2if (a > 0) { 3 print i; 4} data dependence control dependence use definition

4 2006/09/19AOAsia 24 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) dependence control flow concern (open document) slicing result

5 2006/09/19AOAsia 25 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) dependence control flow concern (open document) slicing result barrier [1] Krinke, J.: Slicing, Chopping, and Path Conditions with Barriers. Software Quality Journal, Vol.12, No.4, pp.339-360,December 2004.

6 2006/09/19AOAsia 26 Our Method (2/2) Automatically identify appropriate barriers use heuristics Extract a small subset of conservative slice Closely related to criteria Conservative SlicingOur Method dependence specified criterion concern related result barrier automatically found Barriers

7 2006/09/19AOAsia 27 Extracting a Functional Concern with Slicing 1. 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.

8 2006/09/19AOAsia 28 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

9 2006/09/19AOAsia 29 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

10 2006/09/19AOAsia 210 3.iii. Slicing A backward/forward traversal from criteria The traversal is terminated at barriers. dominator / post-dominator specified criterion barrier added by slicing primary verticesslicing result

11 2006/09/19AOAsia 211 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

12 2006/09/19AOAsia 212 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

13 2006/09/19AOAsia 213 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

14 2006/09/19AOAsia 214 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

15 2006/09/19AOAsia 215 Result: Identified barriers MainWindow.MainWindow() Checker.notifyProgressValue(int) Checker.notifyFinished() Checker.addCheckerListener(CheckerListener) Checker.notifyErrorFile(String) FileList.count() Main.main(String[])Console.execute()Checker.run()Checker.makeDuplicationGroups(Collection ) CheckerLitener.onErrorFileString() String.substring(int) A method entry point without arguments An abstract method entry point Library … … … dependence specified criterion slice barrier


Download ppt "2006/09/19AOAsia 21 Towards Locating a Functional Concern Based on a Program Slicing Technique Takashi Ishio 1,2, Ryusuke Niitani 2 and Katsuro Inoue 2."

Similar presentations


Ads by Google