Indentation in Source Code: A Randomized Control Trial on the Readability of Control Flows in Java Code with Large Effects

Johannes Morzeck, Stefan Hanenberg, Ole Werger, Volker Gruhn

2023

Abstract

Indentation is a well-known principle for writing code. It is taught to progammers and applied in software projects. The typical argument for indentation is that it makes code more readable. However, taking a look into the literature reveals that the scientific foundatation for indentation is rather weak. The present work introduces a four factor experiment with focus on indentation in control flows. In the experiment, 20 participants (10 students and 10 professional developers) were asked to determine the results of given Java code consisting of if-statements and printouts. Measured was the time required to answer the question correctly. The experiment reveals that indentation has a strong (p < .001) and large (η 2 p = .832) positive effect on the readability in terms of answering time. On average participants required 179% more time on non-indented code to answer the question (where the different treatment combinations varied on average between 142% and 269%). Additionally, participants were asked about their subjective impressions on the tasks using the standardized NASA TLX questionnaire (using the categories mental demand, performance, effort, and frustration). It turned out that participants subjectively perceived non–indented code with respect to all categories more negative (p < .001, .4 < η2p < .79).

Download


Paper Citation


in Harvard Style

Morzeck J., Hanenberg S., Werger O. and Gruhn V. (2023). Indentation in Source Code: A Randomized Control Trial on the Readability of Control Flows in Java Code with Large Effects. In Proceedings of the 18th International Conference on Software Technologies - Volume 1: ICSOFT; ISBN 978-989-758-665-1, SciTePress, pages 117-128. DOI: 10.5220/0012087500003538


in Bibtex Style

@conference{icsoft23,
author={Johannes Morzeck and Stefan Hanenberg and Ole Werger and Volker Gruhn},
title={Indentation in Source Code: A Randomized Control Trial on the Readability of Control Flows in Java Code with Large Effects},
booktitle={Proceedings of the 18th International Conference on Software Technologies - Volume 1: ICSOFT},
year={2023},
pages={117-128},
publisher={SciTePress},
organization={INSTICC},
doi={10.5220/0012087500003538},
isbn={978-989-758-665-1},
}


in EndNote Style

TY - CONF

JO - Proceedings of the 18th International Conference on Software Technologies - Volume 1: ICSOFT
TI - Indentation in Source Code: A Randomized Control Trial on the Readability of Control Flows in Java Code with Large Effects
SN - 978-989-758-665-1
AU - Morzeck J.
AU - Hanenberg S.
AU - Werger O.
AU - Gruhn V.
PY - 2023
SP - 117
EP - 128
DO - 10.5220/0012087500003538
PB - SciTePress