There is a newer version of the record available.

Published April 27, 2023 | Version v3
Conference paper Open

An Exploratory Evaluation of Continuous Feedback to Enhance Machine Learning Code Smell Detection

  • 1. ROR icon Universidade Federal de Minas Gerais

Description

Context: Code smells are symptoms of bad design choices implemented on the source code. To manage and enhance software quality, it is important to be aware of code smells and refactor them whenever possible. As a result, several code smell detection tools and techniques have been proposed over the years. These tools and techniques present different strategies to detect code smells. More recently, machine learning algorithms have also been proposed to support code smell detection. However, we lack empirical evidence on how expert feedback could improve detection of these machine learning based techniques. Objective: This paper aims to propose and evaluate a machine-learning based strategy to improve detection of code smells by means of continuous feedback provided by the system expert. Method: To evaluate the strategy, we follow an experimental design to compare results of the detection before and after the feedback, both when feedback is provided at once and continuously. We focus on four code smells - God Class, Long Method, Feature Envy, and Refused Bequest - detected in twenty Java systems by using five code smell detection tools. We also extracted class- and method-level metrics from the systems for training the machine learning algorithms. Results: We observed that continuous feedback improves the performance of code smell detection. For the detection of God Class, a code smell with a detection performance initially good, we achieved an average improvement of 0.13 in terms of F1. For Refused Bequest, another class-level code smell, we achieved an average improvement of 0.58 in terms of F1 after all interactions of the strategy. For the method-level code smells, Long Method and Feature Envy, we achieved an average improvement of 0.66 and 0.72 in terms of F1, respectively. Conclusions: Our promising results are a stepping stone towards the development of tools relying on continuous feedback for machine learning detection of code smells.

Files

diff_f1_by_badsmell.pdf

Files (50.4 MB)

Name Size Download all
md5:d5dff01d6560171f1ce2ac1081883c27
15.6 kB Preview Download
md5:daa1f83f8288dc82629a77e7c1cb5782
23.2 MB Preview Download
md5:3fd8ad067d678e4cc905aec96010806a
2.6 MB Preview Download
md5:7cf8066e0c9c6f1d3ebabd9641c4c566
23.2 MB Preview Download
md5:e8e44b1b3889d23f32e4749f0a76a999
12.2 kB Download
md5:452861b7a0edbb88e857bf9731e62c59
17.8 kB Preview Download
md5:ec247a809ad20d2b80beeb67969f4a12
1.4 MB Preview Download
md5:c3d37c15170d76ae10649a9fa6a5bd98
12.4 kB Preview Download
md5:8d720ab3134226c90317723625b29286
14.8 kB Preview Download