Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change...
Transcript of Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change...
![Page 1: Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change prone than TD-free methods. Among specific types of code smells, long methods and](https://reader033.fdocuments.us/reader033/viewer/2022052719/5f08194b7e708231d4205473/html5/thumbnails/1.jpg)
Assessing Code Smell Interest Probability
A Case Study
Sofia Charalampidou, Apostolos Ampatzoglou, Alexander Chatzigeorgiou, Paris Avgeriou
Apostolos [email protected]
University of Groningen The Netherlands
![Page 2: Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change prone than TD-free methods. Among specific types of code smells, long methods and](https://reader033.fdocuments.us/reader033/viewer/2022052719/5f08194b7e708231d4205473/html5/thumbnails/2.jpg)
Context
Technical Debt
Principal Interest
![Page 3: Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change prone than TD-free methods. Among specific types of code smells, long methods and](https://reader033.fdocuments.us/reader033/viewer/2022052719/5f08194b7e708231d4205473/html5/thumbnails/3.jpg)
Context
Technical Debt
Principal Interest
Interest Amount
Interest Probability
![Page 4: Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change prone than TD-free methods. Among specific types of code smells, long methods and](https://reader033.fdocuments.us/reader033/viewer/2022052719/5f08194b7e708231d4205473/html5/thumbnails/4.jpg)
Context
Technical Debt
Principal Interest
Interest Amount
Interest Probability
Key-Indicator for
TD Prioritization
![Page 5: Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change prone than TD-free methods. Among specific types of code smells, long methods and](https://reader033.fdocuments.us/reader033/viewer/2022052719/5f08194b7e708231d4205473/html5/thumbnails/5.jpg)
Interest Probability
![Page 6: Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change prone than TD-free methods. Among specific types of code smells, long methods and](https://reader033.fdocuments.us/reader033/viewer/2022052719/5f08194b7e708231d4205473/html5/thumbnails/6.jpg)
Smell Interest Probability
Interest probability smell X = 0.5
There is a 50% chance that at least one module suffering
from smell X will change in the next version of the system
How to read it?
![Page 7: Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change prone than TD-free methods. Among specific types of code smells, long methods and](https://reader033.fdocuments.us/reader033/viewer/2022052719/5f08194b7e708231d4205473/html5/thumbnails/7.jpg)
Smell Interest Probability
(a) Prioritize refactoring of most risky smells
(b) TrainingWhy to use it?
![Page 8: Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change prone than TD-free methods. Among specific types of code smells, long methods and](https://reader033.fdocuments.us/reader033/viewer/2022052719/5f08194b7e708231d4205473/html5/thumbnails/8.jpg)
Smell Interest Probability
Joint probability of events
(a) number of events
(b) probability of each maintenance event to occur
(c) P(A|B) = P(A) + P(B) – P(A)*P(B)
How to calculate?
![Page 9: Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change prone than TD-free methods. Among specific types of code smells, long methods and](https://reader033.fdocuments.us/reader033/viewer/2022052719/5f08194b7e708231d4205473/html5/thumbnails/9.jpg)
Case Study Design
![Page 10: Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change prone than TD-free methods. Among specific types of code smells, long methods and](https://reader033.fdocuments.us/reader033/viewer/2022052719/5f08194b7e708231d4205473/html5/thumbnails/10.jpg)
What smells are we interested in?
![Page 11: Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change prone than TD-free methods. Among specific types of code smells, long methods and](https://reader033.fdocuments.us/reader033/viewer/2022052719/5f08194b7e708231d4205473/html5/thumbnails/11.jpg)
Case Study Design
Goal of this study:
What is the interest probability incurred by code smells?
What is the occurrence frequency for each code smell?
What is the mean change proneness of the modules in
which each type of code smell is identified?
![Page 12: Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change prone than TD-free methods. Among specific types of code smells, long methods and](https://reader033.fdocuments.us/reader033/viewer/2022052719/5f08194b7e708231d4205473/html5/thumbnails/12.jpg)
Case & Data Collection
5,5K classes
48K methods ~ Units of analysis
16K commits
![Page 13: Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change prone than TD-free methods. Among specific types of code smells, long methods and](https://reader033.fdocuments.us/reader033/viewer/2022052719/5f08194b7e708231d4205473/html5/thumbnails/13.jpg)
Data Analysis
![Page 14: Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change prone than TD-free methods. Among specific types of code smells, long methods and](https://reader033.fdocuments.us/reader033/viewer/2022052719/5f08194b7e708231d4205473/html5/thumbnails/14.jpg)
Results
![Page 15: Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change prone than TD-free methods. Among specific types of code smells, long methods and](https://reader033.fdocuments.us/reader033/viewer/2022052719/5f08194b7e708231d4205473/html5/thumbnails/15.jpg)
Smell Frequency
The most frequent type of code TD is code clones. However, their frequency-level
is project-related. Concerning long methods, approximately 2-4 can be identified
in a thousand methods. The frequency of Conditional Complexity is also project
related since it varies between less than one to 6 per mille in the two projects.
![Page 16: Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change prone than TD-free methods. Among specific types of code smells, long methods and](https://reader033.fdocuments.us/reader033/viewer/2022052719/5f08194b7e708231d4205473/html5/thumbnails/16.jpg)
Change Proneness
Methods that suffer from code smells are more change prone than TD-free
methods. Among specific types of code smells, long methods and the use of
conditionals instead of polymorphism are usually encountered in change prone
methods. On the other hand code clones are usually positioned in system
parts that do not change frequently.
![Page 17: Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change prone than TD-free methods. Among specific types of code smells, long methods and](https://reader033.fdocuments.us/reader033/viewer/2022052719/5f08194b7e708231d4205473/html5/thumbnails/17.jpg)
Interest Probability
Code clones is the smell that has the higher probability to produce interest in
future maintenance activities in the two examined projects. This characteristic
is mostly attributed to the smell occurrence frequency rather than its
identification in change prone methods. The long method smell is the code TD
type that presents the most similar smell interest probability in the examined
projects.
![Page 18: Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change prone than TD-free methods. Among specific types of code smells, long methods and](https://reader033.fdocuments.us/reader033/viewer/2022052719/5f08194b7e708231d4205473/html5/thumbnails/18.jpg)
Implications
Researchers
Existence of smells and method
change proneness Extra care in
change prone methods
High levels of interest probability
Training in TD prevention and
repayment
The modification of a clone can
cause interest in multiple modules
Alert on types of code TD
Practitioners
More Smells
Different Levels of Granularity
More projects
![Page 19: Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change prone than TD-free methods. Among specific types of code smells, long methods and](https://reader033.fdocuments.us/reader033/viewer/2022052719/5f08194b7e708231d4205473/html5/thumbnails/19.jpg)
Threats to Validity
LIMITATIONS
Construct Validity:
- Tool Accuracy
- Existence of Smells other than the
three examined
Lack of Generalization to:
- Programming Language / Paradigm
- Other smells
Reliability:
- No research bias
- Public repositories
![Page 20: Assessing Code Smell Interest Probability · Methods that suffer from code smells are more change prone than TD-free methods. Among specific types of code smells, long methods and](https://reader033.fdocuments.us/reader033/viewer/2022052719/5f08194b7e708231d4205473/html5/thumbnails/20.jpg)
| 20
Questions???
Thank you for your attention!