An Approach Based on Sum Product Networks for Code Smells Detection
Abstract
From a software engineering perspective, a code smell refers to poor code structure. Many studies have shown that there is a significant negative relationship between code smells and code quality. Thus, many approaches have been proposed to detect and manage them. However, detecting code smells remains a challenging problem. This paper introduces a method (CSDSPN) based on a sum product network (SPN); a probabilistic deep architecture not yet evaluated in the context of code smell detection. SPNs are tractable density estimators that compactly represent a joint probability distribution. The main objective of this paper is to study the performance of a Sum-Product Network as a classifier for code smell detection. To fulfill this objective, the paper proposes an approach that utilizes a classifier based on an SPN trained on data from previous projects, to identify code smells in new source code. An empirical study was conducted to assess the effectiveness of the proposed method in detecting ’God Class,’ ’Long Method,’ and ’Feature Envy’ code smells using well-known datasets. The empirical study evaluated the proposed approach against against seven standard and advanced machine learning models. The results of the study demonstrate the potential of the proposed method in effectively detecting code smells.
Keywords
Code smells, Sum product network, Probability distribution, Source code
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.
M. Abdelkader, "An Approach Based on Sum Product Networks for Code Smells Detection," in Journal of Communications Software and Systems, vol. 21, no. 2, pp. 189-200, May 2025, doi: https://doi.org/10.24138/jcomss-2024-0106
@article{abdelkader2025approachbased, author = {Mostefai Abdelkader}, title = {An Approach Based on Sum Product Networks for Code Smells Detection}, journal = {Journal of Communications Software and Systems}, month = {5}, year = {2025}, volume = {21}, number = {2}, pages = {189--200}, doi = {https://doi.org/10.24138/jcomss-2024-0106}, url = {https://doi.org/https://doi.org/10.24138/jcomss-2024-0106} }