Teaching Code Refactoring Using LLMs

Anshul Khairnar, Aarya Rajoju, Edward F. Gehringer
8/12/2025
cs.SEcs.LG

No confident code implementation found for this paper.

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 principles.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Cite this paper

@article{khairnar2025teaching,
  title  = {Teaching Code Refactoring Using LLMs},
  author = {Anshul Khairnar and Aarya Rajoju and Edward F. Gehringer},
  year   = {2025},
  eprint = {2508.09332},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2508.09332v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2508.09332.svg)](https://codeofpaper.com/paper/2508.09332)

Discussion