Improving Code Comprehension through Cognitive-Load Aware Automated Refactoring for Novice Programmers Conference: The 30th International Conference on Evaluation and Assessment in Software Engineering; 9–12 June, 2026; Glasgow, Scotland, United Kingdom DOI: 10.1145/XXXXXXX.XXXXXXX ISBN: 979-X-XXXX-XXXX-X/2026/XX CCS: Social and professional topics Computer science education CCS: Human-centered computing User studies

Subarna Saha, Alif Al Hasan, Fariha Tanjim Shifat, Mia Mohammad Imran · 2026

Read Improving Code Comprehension through Cognitive-Load Aware Automated Refactoring for Novice Programmers Conference: The 30th International Conference on Evaluation and Assessment in Software Engineering; 9–12 June, 2026; Glasgow, Scotland, United Kingdom DOI: 10.1145/XXXXXXX.XXXXXXX ISBN: 979-X-XXXX-XXXX-X/2026/XX CCS: Social and professional topics Computer science education CCS: Human-centered computing User studies by Subarna Saha, Alif Al Hasan, Fariha Tanjim Shifat, Mia Mohammad Imran (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2603-16791.txt.

Introduction

Saha and co-authors use automated refactoring to help novice programmers understand code. Their tool, CDDRefactorER, rewrites code under limits drawn from Cognitive-Driven Development. The limits curb control-flow complexity while keeping behavior and structure close to the original. On the MBPP and APPS benchmarks, across two language models, the tool cut refactoring failures by 54 to 71 percent. It also lowered the odds that refactoring raised complexity scores. In a study with novices, function identification rose 31.3 percent and structural readability rose 22.0 percent.

Catalog record

CREATORSubarna Saha, Alif Al Hasan, Fariha Tanjim Shifat, Mia Mohammad Imran
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE56390
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2603.16791

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Improving Code Comprehension through Cognitive-Load Aware Automated Refactoring for Novice Programmers Conference: The 30th International Conference on Evaluation and Assessment in Software Engineering; 9–12 June, 2026; Glasgow, Scotland, United Kingdom DOI: 10.1145/XXXXXXX.XXXXXXX ISBN: 979-X-XXXX-XXXX-X/2026/XX CCS: Social and professional topics Computer science education CCS: Human-centered computing User studies Subarna Saha, Alif Al Hasan, Fariha Tanjim Shifat, Mia Mohammad Imran 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 Cyclomatic and Cognitive complexity during refactoring, compared to unconstrained prompting. Results from the human study show consistent improvements in novice code comprehension, with function identification increasing by 31.3% and structural readability by 22.0%. The findings suggest that cognitively guided refactoring offers a practical and effective mechanism for enhancing novice code comprehension. 1. Introduction Program comprehension is a central activity in software development and a persistent challenge for novice programmers ( 17 ; 63 ; 33 ; 46 ; 62 ) . Despite acquiring foundational syntactic and semantic knowledge, novice programmers frequently struggle to comprehend existing code, including identifying program purpose, tracing control-flow, and recognizing functional decomposition. Critically, prior research does not attribute these difficulties to syntactic unfamiliarity. It attributes them to structure, specifically, to deep nesting, complex control-flow, and unclear modular boundaries ( 8 ; 61 ; 62 ; 47 ; 21 ) . Figure 1. Examples from Reddit where novice programmers talking about difficulties in understanding other’s code Figure 1 illustrates this pattern through examples drawn from public programming forums, where novice programmers consistently report that structural organization–not language syntax–is what defeats their attempts at comprehension. Recent empirical work corroborates this: structural breakdowns are a documented trigger for confusion and frustration among novices, and are closely associated with cognitive overload during learning activities ( 30 ) . The structural account of novice difficulty motivates a structural intervention. Refactoring is commonly used to improve code readability by restructuring code while preserving behavior ( 25 ) . If structural characteristics constitute the primary barrier to novice comprehension, then targeted restructuring should, in principle, lower that barrier. Prior empirical work, however, challenges this inference. Refactoring does not consistently improve novice comprehension ( 61 ) . Approaches that emphasize structural reorganization or metric reduction without accounting for the cognitive effort required during comprehension ( 61 ; 41 ; 48 ) may produce transformations that reduce conventional complexity metrics while simultaneously increasing the reasoning burden on novices–disrupting the control-flow paths and data dependencies they had begun to trace ( 10 ; 69 ) . The efficacy of refactoring therefore depends not solely on behavioral preservation but on how structural modifications are constrained. Cognitive-Driven Development (CDD) provides a principled basis for such constraints ( 65 ) . CDD bounds control-flow complexity within individual code units according to working memory capacity limits ( 40 ) , aligning program structure with the cognitive demands of comprehension. Prior work confirms that CDD constraints improve code readability and support developer reasoning ( 51 ; 50 ; 24 ) . However, manual application of CDD remains inconsistent in practice, and novice programmers cannot apply these constraints reliably without external scaffolding ( 67 ; 10 ) . This gap motivates CDDRefactorER , an automated refactoring system that encodes CDD-inspired constraints into the prompting strategy of large language models. Unconstrained prompting produces inconsistent and sometimes counterproductive transformations. CDDRefactorER , by contrast, directs the model to identify code units that exceed cognitive thresholds and to apply refactoring strategies grounded in novice comprehension research, including method extraction, nesting reduction, identifier improvement, and sequential flow organization ( 1 ; 22 ; 43 ; 10 ) , while preserving behavioral fidelity and structural similarity to the original code ( 32 ; 69 ; 25 ) . CDDRefactorER does not perform semantic transformation ( 16 ) , bug fixing, or program repair ( 35 ) . To what extent, cognitive constraints improve refactoring safety, structural control, and novice comprehension requires empirical validation. We pursue that validation through the following three research questions: RQ1: Evaluation of Baseline Unconstrained Prompt. How does an unconstrained prompt perform in refactoring tasks intended to be novice-programmer friendly? We find that unconstrained prompting preserves functional correctness in most cases on novice-oriented benchmarks, but still produces non-trivial refactoring failures. An error analysis reveals that failures commonly arise from unintended logic alterations, injected domain assumptions, and small value discrepancies. RQ2: Validation of CDDRefactorER . How does CDDRefactorER -guided refactoring differ from unconstrained prompting in correctness and code structure? Across two benchmark datasets and two language models, CDDRefactorER reduces refactoring failures by 54.40 to 71.23 percent relative to unconstrained prompting. It substantially lowers the likelihood of increases in cyclomatic and cognitive complexity during refactoring, and preserves higher structural similarity to the original code, indicating more controlled and stable transformations. RQ3: Impact on Comprehension. How does systematic automatic refactoring using CDDRefactorER affect novice programmers’ ability to understand code? Results from a controlled between-subject human study with 20 novice programmers show consistent improvements in self-reported code comprehension after interacting with CDDRefactorER . The largest gains are observed in function identification (+31.3%) and structural readability (+22.0%), while challenges related to unfamiliar programming concepts persist. Contributions. This paper makes two primary contributions: (i) it introduces CDDRefactorER , a cognitively constrained automated refactoring approach, and (ii) it provides empirical evidence of its effects on refactoring correctness, code structure, and novice code comprehension. The replication package is publicly available ( 56 ) . 2. Background and Related Work This section provides the theoretical and empirical context for our work. We first give an overview of Cognitive-Driven Development (CDD), which forms the basis of our refactoring constraints. We then review literature on cognitive load in programming with an emphasis on novice comprehension, and examine prior work on refactoring for code comprehension. Cognitive-Driven Development (CDD) CDD ( 65 ) , grounded in Cognitive Load Theory ( 64 ) and cognitive complexity research ( 9 ) , is a software development approach that constrains code structure based on limits of human working memory ( 40 ) . Rather than optimizing for abstract structural metrics alone, CDD emphasizes bounding the cognitive effort required to reason about control-flow and nesting within individual code units ( 9 ) . CDD quantifies structural complexity through Intrinsic Complexity Points (ICPs), which assign costs to control-flow constructs such as conditionals, loops, and their nesting depth. ICPs are computed by aggregating the contributions of control-flow constructs within a function. Each construct contributes a base cost, and additional cost is incurred through nesting. The resulting ICP value is compared against predefined thresholds to determine whether a code unit exceeds acceptable structural complexity ( 65 )

Read the complete text