AI-Driven Code Optimization: Leveraging ML to Refactor Legacy Codebases - Santhosh Podduturi (North American Journal of Engineering Research, 2025)
Legacy codebases form the backbone of many enterprise systems, yet they often suffer from technical debt, outdated design patterns, and maintainability issues. Traditional refactoring approaches require extensive manual effort, making the process time-consuming and error-prone. With recent advancements in Artificial Intelligence (AI) and Machine Learning (ML), automated techniques for analyzing, refactoring, and optimizing legacy code are emerging as powerful solutions. This paper explores the role of AI-driven approaches in modernizing legacy systems, focusing on how ML models can analyze code structures, detect inefficiencies, and generate optimized refactored versions while preserving functionality. We discuss various AI-based tools and techniques, such as deep learning models for code transformation, reinforcement learning for performance optimization, and intelligent code review systems. Additionally, we examine real-world implementations of AI-driven refactoring, outlining its benefits, challenges, and future directions. By leveraging AI for automated code optimization, organizations can reduce maintenance costs, improve system performance, and accelerate digital transformation. However, challenges such as explainability, trust in AI-generated code, and security concerns remain key areas for further exploration. This paper aims to provide a comprehensive understanding of AI-driven code optimization and its potential to revolutionize software maintenance and modernization.