Natthawute Sae-Lim, Shinpei Hayashi, and Motoshi Saeki Department of Computer Science School of Computing 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 Data Class Feature Envy “Every time you make a “Classes that have fields, kind of change, you have getting and setting to make a lot of little methods for the fields, changes to a lot of and nothing else.” different classes.” [1] M. Fowler. Refactoring: Improving the Design of Existing Code . Addison-Wesley, 1999. 3
Problem The number of code smell is overwhelming 4
Related Work Code Smells Prioritization [ICPC 2016] [MTD 2015] Context-Based Code Smells Towards a Prioritization of Prioritization Code Debt: A Code Smell for Prefactoring Intensity Index Sae-Lim et al. Fontana et al. Code Smells Filtration [CSMR 2004] [ICSE 2015] Using history information to Filtering Code Smells improve design flaws Detection Results detection Fontana et al. Ratiu et al. 5
Related Work Code Smells Prioritization Task relevance Smell severity Code Smells Filtration Historical False positive information 6
Motivation Code Smells Prioritization Task relevance Smell severity No empirical evidence on how developers Code Smells Filtration handle code smells History False positive information 7
Research Questions RQ 1 : What are the factors used by developers in the code smell selection process? RQ 2 : What are the factors used by developers in the code smell prioritization process? 8
STUDY DESIGN 9
Data Collection JabRef Class A God Line 1 Summary Class B Data Line 2 + Class C Blob x5 x22 Description … … Line 3 Line 4 Task Solution Code smell 10
Data Collection Selection Prioritization This smell should be solved This smell should be solved because … (in this order) because … ① Class A God Class C Blob ✔ ② Class B Data Class A God … … Class C Blob ✔ … … x10 Code smells Code smells x10 11
Coding Technique Response Codes It involves many issues. Task relevance It is not a Blob Class after False positive looking into the code. 3 issues came from this Task relevance, single class. This class is Smell severity too generic. 12
RESULTS 13
15 Final Codes Smell severity Task relevance Smell coupling Task importance Co-located smells Task implementation cost Smell false positive Task implementation risk Testability Module importance Readability Module dependency Maintainability Understandability Refactoring cost 14
RQ 1 : Selection Process Top 5 Factors Code Number of responses 33 Task relevance 11 Smell severity Task implementation cost 5 5 Testability 4 Co-located smells Factors considered together Code Number of responses Task relevance, Smell severity 9 5 Task relevance, Testability 15
RQ 2 : Prioritization Process Top 5 Factors Code Number of responses Module importance 14 10 Task relevance 5 Testability 4 Smell severity 3 Maintainability Factors considered together Code Number of responses Module importance, Task relevance 4 3 Module importance, Testability 16
CONCLUSION 17
Conclusion How do developers select and prioritize code smells? Task relevance Selection: Smell severity Module importance Prioritization: Task relevance 18
Take-home message Factors that have not been considered Testability Factors that have Readability been considered Smell coupling Smell severity Maintainability Task relevance Task importance Smell false positive Refactoring cost Co-located smells Understandability Module importance Module dependency Task implementation risk Task implementation cost 19
Recommend
More recommend