Saved in:
Bibliographic Details
Main Authors: Hao, Gao, Hijazi, Haytham, Medeiros, Júlio, Durães, João, Lam, Chan Tong, de Carvalho, Paulo, Madeira, Henrique
Format: Preprint
Published: 2025
Subjects:
Online Access:https://arxiv.org/abs/2504.18345
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866917999195193344
author Hao, Gao
Hijazi, Haytham
Medeiros, Júlio
Durães, João
Lam, Chan Tong
de Carvalho, Paulo
Madeira, Henrique
author_facet Hao, Gao
Hijazi, Haytham
Medeiros, Júlio
Durães, João
Lam, Chan Tong
de Carvalho, Paulo
Madeira, Henrique
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2504_18345
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle NRevisit: A Cognitive Behavioral Metric for Code Understandability Assessment
Hao, Gao
Hijazi, Haytham
Medeiros, Júlio
Durães, João
Lam, Chan Tong
de Carvalho, Paulo
Madeira, Henrique
Software Engineering
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.
title NRevisit: A Cognitive Behavioral Metric for Code Understandability Assessment
topic Software Engineering
url https://arxiv.org/abs/2504.18345