Abstract
Code smells are code structures that indicate a potential issue in code design or implementation. These issues could affect the processes of code testing and maintenance, and overall software quality. Therefore, it is important to detect code smells in the early stages of software development to enhance system quality. Most studies have focused on detecting code smells of a single programming language. This article explores TL for cross-language code smell detection, where Java is the source, and both C# and Python are the target datasets, focusing on Large Class, Long Method, and Long Parameter List code smells. We conducted a comparison study across two transfer learning approaches—instance-based (Importance Weighting Classifier, Nearest Neighbors Weighting, and Transfer AdaBoost) and parameter-based (Transfer Tree, Transfer Forest)—with various base models. The results showed that the instance-based approach outperformed the parameter-based approach, particularly with Transfer AdaBoost using ensemble learning base models. The Transfer AdaBoost approach with Gradient Boosting and Extra Trees achieved consistent and robust results across both C# and Python, with an 83% winning rate, as indicated by the Wilcoxon signed-rank test. These findings underscore the effectiveness of transfer learning for cross-language code smell detection, supporting its generalizability across different programming languages.
| Original language | English |
|---|---|
| Article number | 9293 |
| Journal | Applied Sciences (Switzerland) |
| Volume | 15 |
| Issue number | 17 |
| DOIs | |
| State | Published - Sep 2025 |
Bibliographical note
Publisher Copyright:© 2025 by the authors.
Keywords
- code smell
- detection
- machine learning
- transfer learning
ASJC Scopus subject areas
- General Materials Science
- Instrumentation
- General Engineering
- Process Chemistry and Technology
- Computer Science Applications
- Fluid Flow and Transfer Processes