department of computer science tokyo institute of
play

Department of Computer Science Tokyo Institute of Technology - PowerPoint PPT Presentation

Natthawute Sae-Lim, Shinpei Hayashi, and Motoshi Saeki Department of Computer Science Tokyo Institute of Technology INTRODUCTION 2 Prefactoring [1] Method A() Method A() Blob { Refactoring { ________ ________ } ________ ________ I


  1. Natthawute Sae-Lim, Shinpei Hayashi, and Motoshi Saeki Department of Computer Science Tokyo Institute of Technology

  2. INTRODUCTION 2

  3. Prefactoring [1] Method A() Method A() Blob { Refactoring { ________ ________ } ________ ________ I need to implement } feature X in method A() Difficult Easier ! (´ ・ _ ・ `) (^∇^) [1] V. Rajlich, Software Engineering: The Current Practice. Chapman and Hall/CRC, 2011 3

  4. Problem Code smell detection results I need to implement Method B() { feature X Blob _____ in method A() 1 st _____ _____ } . . . Method A() Method A() Relevant ! Blob 50 th { { _____ _____ _____ _____ } } . . . Problem : Method C() 100 th Blob Results from existing smell detector { _____ do not fit prefactoring phase } 4

  5. Goal Original code smell Proposed code smell detection result detection result 1 st 1 st 2 nd 2 nd 3 rd 3 rd Our technique . . . . . . n th n th Smells that are relevant to developers’ context 5

  6. Key Idea Severity-based Context-based prioritization [1][2] prioritization 1 st 1 st 2 nd 2 nd 3 rd 3 rd I need to improve I need to implement overall quality of feature X the source code in method A() . . . . . . n th n th [1] R. Marinescu, “Assessing technical debt by identifying design flaws in software systems,” IBM Journal of Research and Development, 2012 6 [2] F. A. Fontana, V. Ferme, M. Zanoni, and R. Roveda, “Towards a Prioritization of Code Debt : A Code Smell Intensity Index, “ MTD2015

  7. PROPOSED TECHNIQUE 7

  8. Developers’ context u Developers’ context = modules to be modified Open issue # 1 Fix a bug in login page . . . ITS Open issue # 50 Add “forgot password” feature n This list is used to estimate developers’ context 8

  9. Impact analysis u Identify modules in source code that are likely to be affected by the changes u Impact analysis → Change prediction Relevant modules Change description # 1 LoginPage.login() There is a bug in login page that user can login LoginPage.Reset() successfully if leave the UserPage.setPassword() password field blank. FormField.getPassword() … UserPage.ShowError() 9

  10. Approach overview Bug 123 Bug 123 Bug 123 When When click… When click… TraceLab [1] click… List of modules Impact analysis Change descriptions [2] Main() xxx;; Source code Code smell detection Scoring List of smells 1… 2… 3… Prioritized smells [1] B. Dit, E. Moritz, and D. Poshyvanyk, “A TraceLab-based Solution for Creating, Conducting, and Sharing Feature Location Experiments,”, ICPC2012 10 [2] https://www.intooitus.com/products/infusion

  11. Scoring u Context Relevance Index n Accumulating the score of matched modules in IA result Impact analysis results #1 Relevant modules Score FormField.getPassword() 0.5 Code smell detection results LoginPage.login() 0.1 Smell Level Module CRI … … … … … 0.4 Blob Method LoginPage.login() #50 … … … … Relevant modules Score UserPage.Reset() 0.7 LoginPage.login() 0.3 … 11

  12. EMPIRICAL STUDIES 12

  13. Empirical Studies RQ 2 : Does the accuracy of IA affect quality of the ranking ? RQ 3 : Does Context-based smell prioritization provide more relevant results than the severity-based one? 13

  14. Subjects u Use Dit et al.’s benchmark dataset [1] jEdit JabRef ArgoUML muCommander Bug 123 Bug 123 Bug 123 When When When Ver. X Ver. Y click… click… click… 37-61 smells 91-150 Issues [1] Dit, B., Revelle, M., Gethers, M., and Poshyvanyk, D., "Feature Location in Source Code: A Taxonomy and Survey", JSME2011 14

  15. Metric u nDCG (Normalized Discounted Cumulative Gain) n Metric for evaluating the quality of ranking documents n Relevant documents in higher rank are more useful than the ones in lower rank u Calculate nDCG for: Severity CRI Our VS. approach Reorder u Oracle n Smells occurring in the modules actually modified during two releases 15

  16. Empirical Studies RQ 2 : Does the accuracy of IA affect quality of the ranking ? RQ 3 : Does Context-based smell prioritization provide more relevant results than the severity-based one? 16

  17. RQ 2 Impact analysis [1] VSM LSI VSM+Dyn LSI+Dyn Cut points 5 10 20 30 VSM = Vector Space Model 40 LSI = Latent Semantic Indexing Dyn = Dynamic Analysis [1] M. Gethers, B. Dit, H. Kagdi, and D. Poshyvanyk, “Integrated impact analysis for 17 managing software changes,” ICSE2012

  18. RQ 2 u RQ 2 : Does the accuracy of impact analysis affect quality of the ranking? u Spearman’s correlation coefficient n Evaluate the association between two variables 1 1 1 0.9 0.9 0.9 0.8 0.8 0.8 nDCG 0.7 0.7 0.7 0.6 0.6 0.6 0.5 0.5 0.5 0 0.05 0.1 0.15 0 0.2 0.4 0.6 0 0.05 0.1 0.15 0.2 F- 1 Precision Recall r = 0.24 r = 0.37 r = 0.48 Accuracy of IA tends to affect quality of the ranking by our technique 18

  19. Empirical Studies RQ 2 : Does the accuracy of IA affect quality of the ranking ? RQ 3 : Does Context-based smell prioritization provide more relevant results than the severity-based one? 19

  20. RQ 3 u RQ 3 : Does context-based smell prioritization provide more relevant results than the severity- based one? 1 0.8 0.6 nDCG 0.4 0.2 0 ArgoUML JabRef jEdit muCommander Severity-based Context-based YES ! 20

  21. RQ 3 Baseline Our approach Rank Smell Type Class Name Severity #Issues Rank Smell Type Class Name CRI #Issues 1 8 1 7.90 3 Blob GeneratorCSharp God Project 2 8 2 4.04 7 Blob GeneratorJava God ProjectBrowser 3 8 5 3 4.04 7 God FigAssociation Blob ProjectBrowser 4 8 1 4 2.43 1 Blob ParserDisplay SC StylePanel 5 GeneratorPHP 4 7 5 FigNodeModeIElemen 2.18 4 Blob God 6 7 3 6 1.54 RPB FigClassifierRole God UMLMutableGraphS 7 7 1 7 1.04 Blob Modeller Blob GeneratorCSharp 8 6 8 0.94 3 SC Import God FigEdgeModelIEleme 9 5 1 9 0.91 1 God CoreFactoryMDRImpl God ExtensionMechanism 10 5 10 0.80 1 RPB StylePanelFigText God CoreFactoryMDRImpl 21

  22. CONCLUSION 22

  23. Conclusion Context-based code smells prioritization Prefactoring Automated Accuracy of IA tends to impact the results More relevant results than severity-based 23

Recommend


More recommend