RefactoCNN-system: an optimized deep learning framework for predicting software refactoring opportunities using CNN-based code analysis

Refactoring is crucial for ensuring the long-term quality, readability, and maintainability of software code in evolving systems. The conventional methods for identifying refactoring are almost rule-based or heuristic-driven and have limitations due to the usage of handcrafted features and shallow structural inspection. Such methods generalise poorly across different codebases and often fail to capture the more abstract semantic similarity of source code. Deep learning has recently become significantly more powerful, enabling it to automate these tasks. However, available models are rarely optimised and do not integrate well with real-world development pipelines. To overcome this limitation, we present RefactoCNN-System, an efficient deep learning-based framework that predicts opportunities for macroscopic refactoring from raw Java source code. Syntax Trees (ASTs) and token sequences are thus used as structured representations of code. System maps them to embedding vectors, which are subsequently fed to a custom-made CNN model. The integration of Bayesian hyperparameter tuning and learning rate scheduling improves the model's predictive performance. The refactoring suggestions are generated by the mapping engine using heuristics that transform classification outputs into recommendations that are easy for developers to read. RefactoCNN extends a shallow feature-based classifier and handles common architecture adaptation problems such as heterogeneous datasets and automated feature discovery automatically using full deep learning capabilities, as experimental results show that RefactoCNN outperforms traditional machine learning classifiers and existing deep learning baselines when achieving 94.6% classification accuracy, 93.1% precision, 92.3% recall, and 92.7% F1-score on benchmark datasets. Qualitative analysis and examples from practice provide additional support for the system's practical usability. With a modular, extensible architecture, RefactoCNN serves as a significant resource for automated software maintenance, helping developers proactively manage and improve code quality. Our proposed framework represents a promising direction for improving automated, data-driven refactoring support. Implementation and reproducibility assets are available in our public GitHub repository: https://github.com/Erakasani/RefactoCNN-System.

Authors

Institutions

Publication Details

Journal
Scientific Reports
Published
2026-06-09
DOI
https://doi.org/10.1038/s41598-026-56911-w
Primary Topic
Software Engineering Research
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

RefactoCNN-system: an optimized deep learning framework for predicting software refactoring opportunities using CNN-based code analysis

E. Lakshmi Prasanna, K. Srinivas
Scientific Reports
Software Engineering Research
article

RefactoCNN-system: an optimized deep learning framework for predicting software refactoring opportunities using CNN-based code analysis

E. Lakshmi Prasanna, K. Srinivas
article en

Abstract

Refactoring is crucial for ensuring the long-term quality, readability, and maintainability of software code in evolving systems. The conventional methods for identifying refactoring are almost rule-based or heuristic-driven and have limitations due to the usage of handcrafted features and shallow structural inspection. Such methods generalise poorly across different codebases and often fail to capture the more abstract semantic similarity of source code. Deep learning has recently become significantly more powerful, enabling it to automate these tasks. However, available models are rarely optimised and do not integrate well with real-world development pipelines. To overcome this limitation, we present RefactoCNN-System, an efficient deep learning-based framework that predicts opportunities for macroscopic refactoring from raw Java source code. Syntax Trees (ASTs) and token sequences are thus used as structured representations of code. System maps them to embedding vectors, which are subsequently fed to a custom-made CNN model. The integration of Bayesian hyperparameter tuning and learning rate scheduling improves the model's predictive performance. The refactoring suggestions are generated by the mapping engine using heuristics that transform classification outputs into recommendations that are easy for developers to read. RefactoCNN extends a shallow feature-based classifier and handles common architecture adaptation problems such as heterogeneous datasets and automated feature discovery automatically using full deep learning capabilities, as experimental results show that RefactoCNN outperforms traditional machine learning classifiers and existing deep learning baselines when achieving 94.6% classification accuracy, 93.1% precision, 92.3% recall, and 92.7% F1-score on benchmark datasets. Qualitative analysis and examples from practice provide additional support for the system's practical usability. With a modular, extensible architecture, RefactoCNN serves as a significant resource for automated software maintenance, helping developers proactively manage and improve code quality. Our proposed framework represents a promising direction for improving automated, data-driven refactoring support. Implementation and reproducibility assets are available in our public GitHub repository: https://github.com/Erakasani/RefactoCNN-System.

Scientific Reports
Koneru Lakshmaiah Education Foundation (IN)
Openalex Percentile: Top 3%
Software Engineering Research
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.