Natthawute Sae-Lim, Shinpei Hayashi, and Motoshi Saeki

Department of Computer Science
School of Computing
Tokyo Institute of Technology

INTRODUCTION2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 ClassFeature Envy

“Classes that have fields,getting and setting
methods for the fields,and nothing else.”“Every time you make akind of change, you haveto make a lot of littlechanges to a lot ofdifferent classes.”[1] M. Fowler. Refactoring: Improving the Design of Existing Code. Addison-Wesley, 1999.

3

Problem

The number ofcode smell isoverwhelming

4

Related Work
Code Smells Prioritization[ICPC 2016][MTD 2015]

Context-Based Code Smells
Prioritization
for Prefactoring

Towards a Prioritization of
Code Debt: A Code Smell
Intensity Index

Sae-Lim et al.

Fontana et al.

Code Smells Filtration[CSMR 2004]

Using history information toimprove design flaws
detection
Ratiu et al.

[ICSE 2015]

Filtering Code Smells
Detection Results
Fontana et al.

5Related Work
Code Smells Prioritization

Task relevance

Smell severity

Code Smells Filtration

Historicalinformation

False positive6Motivation
Code Smells Prioritization

Task relevance

Smell severity

No empirical evidence
on howdevelopers
Code Smells Filtration
handlecodesmells
History

information

False positive7

Research Questions
RQ1 : What are the factors used bydevelopers in the code smell
selection process?
RQ2 : What are the factors used bydevelopers in the code smell
prioritization process?
8

STUDY DESIGN

9

Data Collection

JabRefLine 1

Summary
Description+Line 2Line 3x5Class AClass BClass C…

GodDataBlob…

x22

Line 4

TaskSolution

Code smell
10Data Collection
Selection

Prioritization

This smell should be solved
because …

This smell should be solved(in this order) because …

① Class C Blob
② Class A God✔ Class A God
Class B Data…

✔ Class C Blob…

…

…

Code smells

x10

Code smells

x10
11

Coding Technique
ResponseCodes

It involves many issues.

Task relevance

It is not a Blob Class after
looking into the code.

False positive

3 issues came from thissingle class. This class istoo generic.

Task relevance,
Smell severity

12

RESULTS

13

15 Final Codes
Smell severitySmell coupling
Co-located smells
Smell false positive

Task relevance
Task importance
Task implementation cost
Task implementation riskTestability
Readability
Maintainability
Understandability

Module importance
Module dependency
Refactoring cost

14

RQ1: Selection Process
Top 5 Factors
Code

Number of responses

Task relevance33

Smell severity

11

Task implementation cost 5Testability
5Co-located smells

4Factors considered together
Code
Number of responses
Task relevance, Smell severity 9
Task relevance, Testability515

RQ2: Prioritization Process
Top 5 Factors
Code

Number of responsesModule importance 14
Task relevance

10Testability

5

Smell severity

4Maintainability

3Factors considered together
Code

Number of responses

Module importance, Task relevance 4
Module importance, Testability
316

CONCLUSION

17

Conclusion
How do developers select and prioritizecode smells?
Task relevance
Selection:
Smell severity
Module importance
Prioritization:
Task relevance18

Take-home message
Factors that have notbeen considered
Factors that havebeen considered
Smell severity
Task relevance
Smell false positive

Testability
Readability
Smell coupling
Maintainability
Task importanceRefactoring costCo-located smells
Understandability
Module importance
Module dependency
Task implementation risk
Task implementation cost19