1 / 18

David Shepherd, Lori Pollock, and K. Vijay-Shanker

Case Study: Supplementing Program Analysis with Natural Language Analysis to Improve a Reverse Engineering Task. David Shepherd, Lori Pollock, and K. Vijay-Shanker. University of Delaware. Consider the Reverse Eng Task…. Aspect-Oriented Programming , language support for:. Aspect Mining.

jafari
Download Presentation

David Shepherd, Lori Pollock, and K. Vijay-Shanker

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Case Study: Supplementing Program Analysis with Natural Language Analysis to Improve a Reverse Engineering Task David Shepherd, Lori Pollock, and K. Vijay-Shanker • University of Delaware

  2. Consider the Reverse Eng Task… Aspect-Oriented Programming, language support for: Aspect Mining Locates refactoring candidates

  3. Classic Aspect Candidates • Before/After Aspects [Mastering AspectJ, Aspectj.com] • Certain Design Patterns [Hanneman 02] Circle.setRadius(x){ r = x; } Square.setSize(x){ size = x; } Aspect Updater After Shape.set*() Call Display.update() Display.update() Display.update() public MultiFigure(){ numFigs =n;…. } public Square(y){ side = y; } Aspect Listener After Figure.construct() Add parent as listener addListener(Drawing) addListener(MultiFigure)

  4. Current Aspect Mining Analyses Traditional Program Analyses (TPA) Code Clone Analysis Fan-In Analysis [Shepherd SERP 04, Bruntink ICSM 04] [Marin et al. WCRE 2005] Method Display.update() Call Graph Fragment Traditional Program Analyses (TPA) can be effective

  5. Consider Natural Language Analyses (NLA) Scenario • Class: DrawApplication • Methods • addViewChangeListener • removeViewChangeListener Opposite Verbs Observer Word Combo Natural Language Analyses can be effective

  6. Quiz: Is TPA Enough? Which method(s) are good candidates? Method TextAreaTool.beginEdit() Method Geom.length() A B Call Graph Fragments Traditional Program Analyses (TPA) can be misleading

  7. Quiz: Is NLA Enough? Scenario A • Method uses verb “add” • Another method in the same class uses verb “remove” Scenario B • Method uses verb “add” • Another method in the same class uses verb “remove” Natural Language Analyses can be misleading Figure.addListener() List.add()

  8. Summary: TPA & NLA Complementary Using NLA and TPA together tobuild a casefor refactoring Method Auctions.startBlocking() Fan-in is high Called in a clone Opposite verb is used Method Auctions.endBlocking() Supplementing TPA with NLA makes a stronger case for refactoring

  9. Talk Progression • Aspect Mining Framework: Timna Timna Fan-in Method signature Code clone iTimna … NLA • Integration of Natural Language in iTimna • Evaluation

  10. Timna: An Aspect Mining Framework Method name| Fan-in | Code Clone | Is Void openWindow 3 T T addListener 7 F F Timna uses machine learning to combine analyses Phase 1: Learning (occurs once) If( Fan-in >3 and Is-Void) then the method is a refactoring candidate Mining Analyses Analyses Results Mining Rules Tagged Program Learner Phase 2: Classifying (occurs many times) Mining Analyses Analyses Results Marked Program Program Classifer

  11. iTimna: Adding NLA to Timna Analyses Driver Analyses Results … Program Add the NL Analyses here NLAnalyses • Opposite verbs • Observer words • Constraint verbs TPAnalyses • Code clone • Signature analysis • Callsite pairings

  12. An Example NLA • NLA: Past-Tense Verb • Intuition: Past-Tense indicates reactionary • Process: 1. Extract verb [AOSD 06] 2. Use morphological analysis to detect verb tense • Examples: • figureSelectionChanged() • setSelection • drawingInvalidated()  past-tense  changed  set  not past-tense  past-tense  invalidated

  13. Tagger bias? Evaluation Overfitting? Enough examples? • Question: What effect does integrating NLA with TPA have on AM? • Methodology: Manually tag a program, Use AM tools, Check results • Measures: Precision (quality) and Recall (completeness) • Subject Program: JHotDraw • AM Tools: Fan-in, Timna, iTimna (2,739 methods)

  14. Quantitative Results • Fan-in Precision 37 Recall 2 • Timna Precision 62 Recall 60 • iTimna Precision81Recall73

  15. Qualitative Results NLA and Simple Program Information If (Void Return Type & Opposite Verb & No Parameter) Then the method is a candidate

  16. Qualitative Results NLA and Simple Program Information If (Not Void Return Type && Constraint Verb) Then the method is a candidate

  17. Related Work • Mining Dynamic Information [Breu ASE 04, Ceccato WCRE 04] • Mining Static Information [Marin WCRE 04, Shepherd SERP 04, Bruntink ICSM 04] • Combining/Comparing Approaches • Sorts [Marin WCRE 2006] • Qualitative Comparison [Tourwe IWPC 05] Single Analyses Simple Combinations Recommend Combining

  18. Conclusions • Created NLAs for Aspect Mining • Showed that TPA and NLA can work together • Evaluated prototype, shows strong promise Supplementing TPA with NLA improves the effectiveness of our aspect mining framework and warrants further evaluation

More Related