Natthawute Sae-Lim, Shinpei Hayashi, and Motoshi Saeki Department of Computer Science Tokyo Institute of Technology
INTRODUCTION 2
Code smell [1] An indicator of a design flaw or a problem in the source code One of the factors that cause technical debt Increases code component’s fault-proneness Refactoring Duplicated Code (Extract Method) [1] M. Fowler. Refactoring: Improving the Design of Existing Code . Addison-Wesley, 1999. 3
Problem The number of code smell is overwhelming 4
Code Smells Prioritization [MTD 2015] [J. ASE 2016] Towards a Prioritization of An Approach to Prioritize Code Debt: A Code Smell Code Smells for Refactoring Intensity Index Vidal et al. Fontana et al. [ICPC 2016] Context-Based Code Smells Prioritization for Prefactoring Sae-Lim et al. [SBSE 2013] [ICSE 2016] Prioritization of Code Technical Debt Prioritization Anomalies based on using Predictive Analytics Architecture Sensitiveness Codabux et al. Arcoverde et al. 5
CONTEXT-BASED CODE SMELLS PRIORITIZATION 6
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 in this situation } 7
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 8
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 9 [2] https://www.intooitus.com/products/infusion
Empirical Study jEdit JabRef 1… Prioritize 2… 3… ArgoUML Prioritized smells Code smells muCommander Compare VCS Conclusion Modification- Our technique can prioritize based oracle code smells occurring in the Code smells modules that are going to be modified 10
Software change process [1] Initiation Interaction History Identify a module to be Concept Location Referred modified Modules Identify a full set of modules to be Impact Analysis modified Prefactoring Version Control System Modified Modify source code Modules Actualization Postfactoring Conclusion [1] V. Rajlich, Software Engineering: The Current Practice . Chapman and Hall/CRC, 2011 11
Mylyn Task and application lifecycle management (ALM) framework for Eclipse. 12
Mylyn Developer selects text in editor <InteractionEvent Delta="null" EndDate="2009-09-08 18:34:51.838 PDT" Interest="1.0" Kind="edit" Navigation="null" OriginId="org.eclipse.jdt.ui.CompilationUnitEditor" StartDate="2009-09-08 18:34:51.838 PDT" StructureHandle="=org.eclipse.mylyn.internal.context. ui{IContextUiHelpIds.java" StructureKind="java” /> 13
Software change process [1] Initiation ? Interaction History Identify a module to be Concept Location Referred modified Modules Identify a full set of modules to be Impact Analysis modified ✓ Prefactoring Version Control System Modified Modify source code Modules Actualization Postfactoring Conclusion [1] V. Rajlich, Software Engineering: The Current Practice . Chapman and Hall/CRC, 2011 14
Software change process [1] Initiation ? Interaction History Identify a Is our technique module to be Concept Location Referred modified Modules Identify a full set of modules to be Impact Analysis modified ✓ useful for Prefactoring Version Control System Modified Modify source code Modules Actualization referred context? Postfactoring Conclusion [1] V. Rajlich, Software Engineering: The Current Practice . Chapman and Hall/CRC, 2011 15
EMPIRICAL STUDY 16
Overview Subject: MylynTask 3.07-3.21 1… 2… 3… Prioritized smells Compare Compare VCS Interaction History Reference- Modification- based oracle based oracle Code smells Code smells 17
Result u Is our technique useful for referred modules? 1 0.78 0.8 0.66 0.6 nDCG 0.4 0.2 0 Modification-based Reference-based Our technique can be useful to support both modified modules and referred modules 18
Top 10 results Rank Smell Type Class Name #RI #MI 1 7 4 God TasksUiInternal 2 9 3 God TasksUiPlugin 3 3 1 God TaskListIndex 4 3 2 God AbstractTaskEditorPage 4 2 5 God TaskDataManager 6 1 1 God TracRepositoryConnector 7 4 1 God AttachmentUtil 8 3 0 God SynchronizeTasksJob 9 3 0 Data TaskData 0 2 10 God BugzillaRepositoryConnector #RI = Number of referring issues #MI = Number of modifying issues 19
CONCLUSION 20
Messages Context-based code smells prioritization Modified Context Referred Context Can support both types of context 21
Recommend
More recommend