NRevisit: A Cognitive Behavioral Metric for Code Understandability Assessment

  • Hao Gao
  • , Haytham Hijazi
  • , Júlio Medeiros
  • , João Durães
  • , Chan Tong Lam
  • , Paulo de Carvalho
  • , Henrique Madeira

Research output: Chapter in Book/Report/Conference proceedingConference contributionpeer-review

Abstract

Measuring code understandability is both highly relevant and exceptionally challenging. This paper proposes a dynamic code understandability assessment method, which estimates a personalized code understandability score from the perspective of the specific programmer handling the code. The method consists of dynamically dividing the code unit under development or review in code regions (invisible to the programmer) and using the number of revisits (NRevisit) to each region as the primary feature for estimating the code understandability score. This approach removes the uncertainty related to the concept of a "typical programmer"assumed by static software code complexity metrics and can be easily implemented using a simple, low-cost, and non-intrusive desktop eye tracker or even a standard computer camera. This metric was evaluated using cognitive load measured through electroencephalography (EEG) in a controlled experiment with 35 programmers. Results show a very high correlation ranging from rs = 0.9067 to rs = 0.9860 (with p nearly 0) between the scores obtained with different alternatives of NRevisit and the ground truth represented by the EEG measurements of programmers' cognitive load, demonstrating the effectiveness of our approach in reflecting the cognitive effort required for code comprehension. The paper also discusses possible practical applications of NRevisit, including its use in the context of AI-generated code, which is already widely used today.

Original languageEnglish
Title of host publicationProceedings of the 29th International Conference on Evaluation and Assessment in Software Engineering , EASE, 2025 edition, EASE 2025
EditorsMuhammad Ali Babar, Ayse Tosun, Stefan Wagner, Viktoria Stray
PublisherAssociation for Computing Machinery, Inc
Pages908-918
Number of pages11
ISBN (Electronic)9798400713859
DOIs
Publication statusPublished - 24 Dec 2025
Externally publishedYes
Event29th International Conference on Evaluation and Assessment of Software Engineering, EASE 2025 - Istanbul, Turkey
Duration: 17 Jun 202520 Jun 2025

Publication series

NameProceedings of the 29th International Conference on Evaluation and Assessment in Software Engineering , EASE, 2025 edition, EASE 2025

Conference

Conference29th International Conference on Evaluation and Assessment of Software Engineering, EASE 2025
Country/TerritoryTurkey
CityIstanbul
Period17/06/2520/06/25

Keywords

  • Code complexity metrics
  • Cognitive load
  • EEG
  • Program comprehension
  • Software quality

Fingerprint

Dive into the research topics of 'NRevisit: A Cognitive Behavioral Metric for Code Understandability Assessment'. Together they form a unique fingerprint.

Cite this