Teaching Code Refactoring Using LLMs
Anshul Khairnar, Aarya Rajoju, Edward F. Gehringer

TL;DR
This paper investigates how Large Language Models can be integrated into software engineering education to provide real-time, context-aware feedback on code refactoring, aiming to improve student learning and code quality.
Contribution
It introduces a novel approach of using LLMs for teaching refactoring with structured prompts, bridging theoretical knowledge and practical skills in a classroom setting.
Findings
Students found LLM feedback helpful for understanding refactoring.
Initial results indicate improved code quality in student projects.
LLMs supported deeper engagement with maintainability concepts.
Abstract
This Innovative Practice full paper explores how Large Language Models (LLMs) can enhance the teaching of code refactoring in software engineering courses through real-time, context-aware feedback. Refactoring improves code quality but is difficult to teach, especially with complex, real-world codebases. Traditional methods like code reviews and static analysis tools offer limited, inconsistent feedback. Our approach integrates LLM-assisted refactoring into a course project using structured prompts to help students identify and address code smells such as long methods and low cohesion. Implemented in Spring 2025 in a long-lived OSS project, the intervention is evaluated through student feedback and planned analysis of code quality improvements. Findings suggest that LLMs can bridge theoretical and practical learning, supporting a deeper understanding of maintainability and refactoring…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
