Table of Contents
Fetching ...

EnseSmells: Deep ensemble and programming language models for automated code smells detection

Anh Ho, Anh M. T. Bui, Phuong T. Nguyen, Amleto Di Salle, Bach Le

TL;DR

EnseSmells tackles code smell detection by fusing statistical semantic features from pre-trained programming-language models with structural software metrics in a two-tier architecture. The Extractor generates complementary embeddings from pre-trained code models (CodeBERT, CuBERT, Code2Vec) and a structural metrics pathway, which are then concatenated and classified by an imbalanced DNN. On the MLCQ dataset, EnseSmells achieves state-of-the-art performance, with improvements ranging from $5.98\%$ to $28.26\%$ depending on the code smell type, outperforming both the prior DeepSmells approach and several baselines. The approach demonstrates that combining semantics-aware representations with design-oriented metrics yields robust code smell detection and offers a practical path toward reducing technical debt in software maintenance.

Abstract

A smell in software source code denotes an indication of suboptimal design and implementation decisions, potentially hindering the code understanding and, in turn, raising the likelihood of being prone to changes and faults. Identifying these code issues at an early stage in the software development process can mitigate these problems and enhance the overall quality of the software. Current research primarily focuses on the utilization of deep learning-based models to investigate the contextual information concealed within source code instructions to detect code smells, with limited attention given to the importance of structural and design-related features. This paper proposes a novel approach to code smell detection, constructing a deep learning architecture that places importance on the fusion of structural features and statistical semantics derived from pre-trained models for programming languages. We further provide a thorough analysis of how different source code embedding models affect the detection performance with respect to different code smell types. Using four widely-used code smells from well-designed datasets, our empirical study shows that incorporating design-related features significantly improves detection accuracy, outperforming state-of-the-art methods on the MLCQ dataset with with improvements ranging from 5.98% to 28.26%, depending on the type of code smell.

EnseSmells: Deep ensemble and programming language models for automated code smells detection

TL;DR

EnseSmells tackles code smell detection by fusing statistical semantic features from pre-trained programming-language models with structural software metrics in a two-tier architecture. The Extractor generates complementary embeddings from pre-trained code models (CodeBERT, CuBERT, Code2Vec) and a structural metrics pathway, which are then concatenated and classified by an imbalanced DNN. On the MLCQ dataset, EnseSmells achieves state-of-the-art performance, with improvements ranging from to depending on the code smell type, outperforming both the prior DeepSmells approach and several baselines. The approach demonstrates that combining semantics-aware representations with design-oriented metrics yields robust code smell detection and offers a practical path toward reducing technical debt in software maintenance.

Abstract

A smell in software source code denotes an indication of suboptimal design and implementation decisions, potentially hindering the code understanding and, in turn, raising the likelihood of being prone to changes and faults. Identifying these code issues at an early stage in the software development process can mitigate these problems and enhance the overall quality of the software. Current research primarily focuses on the utilization of deep learning-based models to investigate the contextual information concealed within source code instructions to detect code smells, with limited attention given to the importance of structural and design-related features. This paper proposes a novel approach to code smell detection, constructing a deep learning architecture that places importance on the fusion of structural features and statistical semantics derived from pre-trained models for programming languages. We further provide a thorough analysis of how different source code embedding models affect the detection performance with respect to different code smell types. Using four widely-used code smells from well-designed datasets, our empirical study shows that incorporating design-related features significantly improves detection accuracy, outperforming state-of-the-art methods on the MLCQ dataset with with improvements ranging from 5.98% to 28.26%, depending on the type of code smell.

Paper Structure

This paper contains 22 sections, 2 equations, 3 figures, 11 tables.

Figures (3)

  • Figure 1: The overall architecture of EnseSmells.
  • Figure 2: Performance of EnseSmells and DeepSmells across different embedding techniques.
  • Figure 3: Performance of EnseSmells and DeepSmells in various embedding techniques.