Improving Code Comprehension through Cognitive-Load Aware Automated Refactoring for Novice Programmers
Subarna Saha, Alif Al Hasan, Fariha Tanjim Shifat, Mia Mohammad Imran

TL;DR
This paper introduces CDDRefactorER, an automated, cognitively guided code refactoring approach that improves novice programmers' understanding by reducing complexity and enhancing readability.
Contribution
It presents a novel automated refactoring method based on Cognitive-Driven Development to improve code clarity for novices, validated through datasets and human studies.
Findings
Reduces refactoring failures by 54-71%
Lowers Cyclomatic and Cognitive complexity during refactoring
Improves novice code comprehension by 31.3% in function identification and 22.0% in readability
Abstract
Novice programmers often struggle to comprehend code due to vague naming, deep nesting, and poor structural organization. While explanations may offer partial support, they typically do not restructure the code itself. We propose code refactoring as cognitive scaffolding, where cognitively guided refactoring automatically restructures code to improve clarity. We operationalize this in CDDRefactorER, an automated approach grounded in Cognitive-Driven Development that constrains transformations to reduce control-flow complexity while preserving behavior and structural similarity. We evaluate CDDRefactorER using two benchmark datasets (MBPP and APPS) against two models (gpt-5-nano and kimi-k2), and a controlled human-subject study with novice programmers. Across datasets and models, CDDRefactorER reduces refactoring failures by 54-71% and substantially lowers the likelihood of increased…
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.
