TY - JOUR
T1 - A systematic literature review on the impact of formatting elements on code legibility
AU - Oliveira, Delano
AU - Santos, Reydne
AU - Madeiral, Fernanda
AU - Masuhara, Hidehiko
AU - Castor, Fernando
N1 - Funding Information:
We thank the anonymous reviewers for their valuable feedback that made us improve this paper. This work was partially supported by the Federal Institute of Education, Science, and Technology of Pernambuco, the Foundation for Support of Science and Technology of Pernambuco State, the Swedish Foundation for Strategic Research under the TrustFull project, and INES 2.0 (FACEPE PRONEX APQ 0388-1.03/14 and APQ-0399-1.03/17, and CNPq 465614/2014-0).
Publisher Copyright:
© 2023
PY - 2023/9
Y1 - 2023/9
N2 - Context: Software programs can be written in different but functionally equivalent ways. Even though previous research has compared specific formatting elements to find out which alternatives affect code legibility, seeing the bigger picture of what makes code more or less legible is challenging. Goal: We aim to find which formatting elements have been investigated in empirical studies and which alternatives were found to be more legible for human subjects. Method: We conducted a systematic literature review and identified 15 papers containing human-centric studies that directly compared alternative formatting elements. We analyzed and organized these formatting elements using a card-sorting method. Results: We identified 13 formatting elements (e.g., indentation) and 33 levels of formatting elements (e.g., two-space indentation), which are about formatting styles, spacing, block delimiters, long or complex code lines, and word boundary styles. While some levels were found to be statistically better than other equivalent ones in terms of code legibility, e.g., appropriate use of indentation with blocks, others were not, e.g., formatting layout. For identifier style, we found divergent results, where one study found a significant difference in favor of camel case, while another study found a positive result in favor of snake case. Conclusion: The number of identified papers, some of which are outdated, and the many null and contradictory results emphasize the relative lack of work in this area and underline the importance of more research. There is much to be understood about how formatting elements influence code legibility before the creation of guidelines and automated aids to help developers make their code more legible.
AB - Context: Software programs can be written in different but functionally equivalent ways. Even though previous research has compared specific formatting elements to find out which alternatives affect code legibility, seeing the bigger picture of what makes code more or less legible is challenging. Goal: We aim to find which formatting elements have been investigated in empirical studies and which alternatives were found to be more legible for human subjects. Method: We conducted a systematic literature review and identified 15 papers containing human-centric studies that directly compared alternative formatting elements. We analyzed and organized these formatting elements using a card-sorting method. Results: We identified 13 formatting elements (e.g., indentation) and 33 levels of formatting elements (e.g., two-space indentation), which are about formatting styles, spacing, block delimiters, long or complex code lines, and word boundary styles. While some levels were found to be statistically better than other equivalent ones in terms of code legibility, e.g., appropriate use of indentation with blocks, others were not, e.g., formatting layout. For identifier style, we found divergent results, where one study found a significant difference in favor of camel case, while another study found a positive result in favor of snake case. Conclusion: The number of identified papers, some of which are outdated, and the many null and contradictory results emphasize the relative lack of work in this area and underline the importance of more research. There is much to be understood about how formatting elements influence code legibility before the creation of guidelines and automated aids to help developers make their code more legible.
KW - Code legibility
KW - Formatting elements
KW - Program understandability
UR - http://www.scopus.com/inward/record.url?scp=85163388981&partnerID=8YFLogxK
U2 - 10.1016/j.jss.2023.111728
DO - 10.1016/j.jss.2023.111728
M3 - Article
AN - SCOPUS:85163388981
SN - 0164-1212
VL - 203
JO - Journal of Systems and Software
JF - Journal of Systems and Software
M1 - 111728
ER -