Detecting Organised Crime Group Activity by Detecting GPS ...
Automatically detecting and describing high level actions within methods Presented by: Gayani...
-
Upload
elmer-park -
Category
Documents
-
view
217 -
download
0
Transcript of Automatically detecting and describing high level actions within methods Presented by: Gayani...
![Page 1: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/1.jpg)
Automatically detecting and describing high level actions within methods
Presented by:Gayani Samaraweera
![Page 2: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/2.jpg)
The problem
Given signature and the body of a method M, automatically discover each code fragment that implements a high level action comprising the overall algorithm of M, and accurately express each high level action as a succinct natural language description
![Page 3: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/3.jpg)
![Page 4: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/4.jpg)
OutlineThe problemOutlineHigh level actionsMethodEvaluationConcernsOther usesConclusion
![Page 5: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/5.jpg)
High level actionsSequence fragment
A sequence of statements that when taken together represents a single high level action
Conditional fragment A conditional block that performs an
action with subtle variations based on the condition
Loop fragment Code patterns that are commonly
implemented using loop constructs that constitute a high level action
![Page 6: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/6.jpg)
Method
![Page 7: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/7.jpg)
Detecting high level actions Uses
AST (Abstract Syntax Tree) CFG (Control Flow Gragh) Information from naming
conventions and linguistic knowledge gained from observations of Java programs Textual clues from SWUM (Software
Word Usage Model)
![Page 8: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/8.jpg)
cont..
Word usage information from identifiers Identifier splitting
Camel case splitting: on capital letters, underscores, numbers
Eg: childXMLElement → child XML Element
Expand identifier abbreviations Eg: Button butSelectAll, MouseEvent evt
SWUM → action, theme, optional secondary arguments of a statement grouping Eg: list.add(Item i); → “add item to list”
themeaction secondary argument
![Page 9: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/9.jpg)
Sequence as single actionSequence fragmentsIdentifying sequences of
statements with similar actions◦Indicated by similar method calls
![Page 10: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/10.jpg)
cont..
Challenges Integrate to successor statement based
on similarity Different method names
Same method name different parameter types
![Page 11: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/11.jpg)
cont..
Identifying fragments Statements with one or more
method callsAdd ended panel to content panel
Add bid panel to content panel
Verb → add → equalsHead word of NP → panel → equalsPreposition → to content panel → equals
→ integratable
![Page 12: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/12.jpg)
cont..
Synthesizing descriptions If equal head word → plural Else
Add okButton to content panel
Head word of NP → differentBut if fields of same class → “all attributes” “different attributes”
![Page 13: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/13.jpg)
Abstracting conditionals
Challenges Integrating similar statements in
different branches Integrating conditional
statements guarding different branches
Integrating return statements with literals or similar method calls
![Page 14: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/14.jpg)
cont..
Identifying and describing conditionals Integrate statements of each block,
compare each statement with statements of parent block For method calls
Singular
![Page 15: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/15.jpg)
cont..
For return statements
For assignment statements
Theme based on enclosing method
Update, create or get
![Page 16: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/16.jpg)
cont..
Describing conditional expressions Compare phrases as 'subject
predicate object' Subject and predicate are equal →
based on what <subject> <predicate>Based on what os name starts with
If only head word of subject is equalBased on which <head word> <predicate> <object>
Based on which radio button is selected
![Page 17: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/17.jpg)
Finding traceable patterns in loops
Challenges Common algorithms as finding,
counting, copying Develop identification templates Develop heuristics to synthesize
phrases for each template
![Page 18: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/18.jpg)
cont..
Loop abstractions implemented Count Contains Find Copy Max-min
![Page 19: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/19.jpg)
cont..
Identifying fragments and synthesize templates
![Page 20: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/20.jpg)
cont..
Variations in synthesis templates 'find item (in collection)
whose/which/such that <criteria>'in subject predicate object, If item is subject → which If an attribute of item is subject →
whose Default → such that
![Page 21: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/21.jpg)
Evaluation
Executed on 1.2 million methods across 1000 Java programs
![Page 22: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/22.jpg)
cont..
How prevalent are the implemented high level methods? Sequence (methods with >= 10 statements
12.5%) 11%
Conditional 40% of if-else 24% of switch
Loop 51% of loops classified as iterating over all items in
a collection 15% of iterator loops detected by implemented
patterns
![Page 23: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/23.jpg)
cont..
Potential reduction in reading detail Reduction in identified high level
actions Sequence → one phrase
22% of original size Conditional → two phrases
29% of original size Loop → varying # phrases
25% of original size
![Page 24: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/24.jpg)
cont..
Precision of identification and description 15 human evaluators, each
evaluating 15 code fragments (5-sequence, 5-conditional, 5-loop)
75 code fragments from 15 projects evaluated by 3 evaluators
From methods with <= 20 statements25-conditional, 25-sequence, 25-loop
Loops: 5 fragments from each 5 patterns
![Page 25: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/25.jpg)
cont..
Evaluators wrote an abstraction of the method
Answered following based on 1 – strongly disagree to 5 – strongly
agree
identification
description
![Page 26: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/26.jpg)
cont..
Majority agreed or strongly agreed on both P1 and P2
![Page 27: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/27.jpg)
Concerns..
May not generalize to other Java programs
Results may vary on larger programs Results might not hold with novices Reduction in reading measurement
may not hold with some developers
![Page 28: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/28.jpg)
Improving client tools Extract method refactoring
Create application based on whatos starts with
Set different attributes of SVGApplicationModel
![Page 29: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/29.jpg)
cont..
Internal comment generation Instead of Extract Method
refactoring, can add comments inline
Add empty lines between related code fragments
Suggesting more informative method names
Improving automatically generated summary comments for a method
![Page 30: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/30.jpg)
Conclusions
First technique for identifying code fragments of statement sequences, conditionals and loops, that is abstracted to a high level action
Automatically synthesizing natural language description
![Page 31: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/31.jpg)
References1. Giriprasad Sridhara, Lori Pollock, and K. Vijay-Shanker.
Automatically detecting and describing high level actions within methods. In Proceeding of the 33rd international conference on Software engineering (ICSE '11). ACM, New York, NY, USA, 101-110.
2. G. Sridhara, E. Hill, D. Muppaneni, L. Pollock, and K. Vijay-Shanker. Towards Automatically Generating Summary Comments for Java Methods. Intl. Conf on Automated Softw. Engg. (ASE’10), 2010.
3. Giriprasad Sridhara, Lori Pollock, K. Vijay-Shanker, "Generating Parameter Comments and Integrating with Method Summaries," International Conference on Program Comprehension, pp. 71-80, 2011 IEEE 19th International Conference on Program Comprehension, 2011
4. E. Hill. Integrating Natural Language and Program Structure Information to Improve Software Search and Exploration. PhD Dissertation, University of Delaware, 2010.
![Page 32: Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.](https://reader035.fdocuments.in/reader035/viewer/2022062805/5697bfac1a28abf838c9ba0b/html5/thumbnails/32.jpg)
Thank you for listening!