Skip to content
Review Open access

ML-Enhanced Code Refactoring Recommendations for Improving Software Maintainability

2019 · International Journal of Modern Innovations and Emerging Trends · 0 citations

TL;DR

Results show that ML-enhanced recommendations outperform traditional methods in accuracy, relevance, and impact on maintainability metrics, and highlight the potential of integrating ML into modern development practices to support developers in producing cleaner, more maintainable software systems.

Abstract

Software maintainability is a critical quality attribute influencing the long-term sustainability, scalability, and cost-effectiveness of software systems. Traditional refactoring approaches often rely on manual inspection or rule-based static analysis, which can be time-consuming, inconsistent, and limited in capturing deeper code quality issues. Recent advances in machine learning (ML) provide new opportunities to automate and enhance refactoring recommendations by learning from large codebases, identifying complex patterns, and predicting optimal refactoring strategies. This paper investigates ML-driven approaches for generating code refactoring recommendations aimed at improving maintainability. We review existing techniques, propose an ML-based framework capable of detecting maintainability hotspots and suggesting targeted refactorings, and evaluate its effectiveness through empirical experiments on real-world repositories. Results show that ML-enhanced recommendations outperform traditional methods in accuracy, relevance, and impact on maintainability metrics. The findings highlight the potential of integrating ML into modern development practices to support developers in producing cleaner, more maintainable software systems.

Read PDF

Similar papers

Book Open access Jul 2026

When Testing Meets Refactoring: Catalogue, Detection, and Recommendation

This paper presents a unified catalogue of test refactoring patterns derived from a mixed-method approach involving repository mining, developer surveys, and analysis of StackOverflow discussions, to establish a rigorous benchmark for evaluating future automated recommendation systems, including those driven by Large Language Models.

Victor Guerra Veloso · 0 citations
Conference Open access 2026

Enhancing Code Quality through AI-Powered Metric-Driven Refactoring: A Multi-Model Analysis

: The growing adoption of large language models (LLMs) in software engineering has introduced new opportunities but also risks in the software maintenance lifecycle. While LLMs can generate entire codebases from natural language prompts, such automatically generated or rapidly prototyped code often accumulates structural debt, making systematic refactoring increasingly urgent. This work investigates LLMs as metric-driven refactoring assistants rather than code generators. Six models (ChatGPT, Claude, Gemini, Grok, DeepSeek, and Qwen) were evaluated on two types of Java projects: three controlled applications with manually inflated structural metrics, and three real-world applications from public GitHub repositories. Using MetricsReloaded in IntelliJ IDEA, we measured four CK metrics: complexity (WMC), cohesion (LCOM), coupling (CBO), and inheritance depth (DIT). Results indicate that LLMs significantly reduce complexity and coupling, improving class simplicity and modularity. However, cohesion improvements remained limited, with LCOM proving especially elusive. Inheritance depth showed strong reductions in synthetic high-metric applications but minimal change in real projects. ChatGPT produced the most consistent and structurally stable refactoring outputs in real applications, though occasional cohesion deterioration occurred. These findings suggest that while LLMs are valuable assistants for structural improvement, their interventions require careful monitoring to avoid unintended trade-offs.

Tindwende Sawadogo, Fadel Touré · 0 citations
Open access 2019

Data-Centric Refactoring: Techniques for Improving Model Quality via Codebase Changes

Machine learning systems often fail to reach optimal performance not because of inadequate model architectures, but due to poorly structured data processing pipelines hidden within the codebase. Data-centric refactoring aims to improve model quality through systematic restructuring of code elements responsible for data collection, preprocessing, transformation, validation, and feature engineering. This paper introduces a comprehensive taxonomy of data-centric refactoring strategies, investigates their application across ML-driven software projects, and evaluates their impact on model accuracy, robustness, maintainability, and reproducibility. By bridging software refactoring principles with data-centric AI practices, the proposed framework demonstrates that code-level improvements to data handling routines can yield substantial gains in model performance while reducing technical debt. Experimental results show that systematically refactoring data pipelines leads to more reliable features, reduced noise propagation, and improved generalization. The findings position data-centric refactoring as a key discipline for modern ML engineering, enabling scalable, interpretable, and production-ready models.

Fatou Diop · 0 citations
Preprint Aug 2026

Detecting Behavioral Changes in Python Refactoring Implementations with Foundation Models

This work proposes an approach based on a foundation model oracle that analyzes git-style diffs to identify behavioral changes introduced by Python refactorings and uncovered 13 distinct bugs among the seven refactoring types studied.

Jonhnanthan Oliveira, Rohit Gheyi, Márcio Ribeiro et al. · 0 citations
Open access 2020

Machine Learning for Code Smell Detection and Resolution

Code smells are indicative of poor software design, maintainability issues, or potential defects, and their early detection is critical for high-quality software development. Traditional detection methods rely heavily on manual inspection or rule-based static analysis, which are often time-consuming, error-prone, and limited in adaptability. This paper explores the use of machine learning techniques for automated code smell detection and resolution. By leveraging code metrics, syntactic and semantic features, and historical refactoring data, ML models can identify patterns associated with common code smells and recommend targeted resolution strategies. The proposed approach is evaluated on open-source and industrial software projects, demonstrating improvements in detection accuracy, maintainability, and developer productivity. The study highlights the potential of intelligent, data-driven approaches to enhance software quality and support continuous code improvement.

Emily Johnson · 0 citations