An Empirical Study on the Impact of String Interpolation on Program Readability and Comprehension

Objectives. Literal string interpolation is a widely used programming language construct that allows developers to embed variables, expressions, and functions directly within strings (e.g., f‘‘Hello, {name}!’’), reducing the need for explicit concatenation. Compared to traditional concatenation, it is often considered more concise and expressive. However, its effect on program readability and comprehension remains underexplored. The objective of this study is to empirically examine how literal string interpolation influences program readability and comprehension relative to conventional string concatenation. Participants. A total of 314 participants took part in the study, representing a broad range of educational and professional stages. All participants possessed prior experience with at least one programming language, ensuring baseline familiarity with programming syntax and logic structures relevant to the study tasks. While the majority were recruited through our Department of Computer Science, additional participants were reached via a public broadcast shared on LinkedIn, which expanded recruitment beyond the immediate university community. Study Methods. We conducted a randomized controlled experiment using a within-subjects repeated-measures design. Data were collected through a custom-built experimental tool designed to present randomized programming tasks under two conditions: concatenation and interpolation. For each task, two dependent variables i.e. completion time and response correctness, were automatically recorded to measure performance and comprehension accuracy. Findings. String concatenation, particularly in complex expressions, significantly reduced program readability and increased comprehension time. A repeated-measures ANOVA revealed a significant main effect of task category, \(F(1,5026)=92.35\), \(p<.001\), \(\eta^{2}_{G}=.018\), indicating differences in completion time between concatenation and interpolation tasks. There was also a smaller but statistically significant main effect of academic level, \(F(6,5026)=2.41\), \(p=.025\), \(\eta^{2}_{G}=.003\). The interaction between task category and academic level was not significant, \(F(6,5026)=0.03\), \(p=1.00\), \(\eta^{2}_{G}=.00\), suggesting that the effect of task category was consistent across levels of academic experience. Accuracy was generally high, with a moderate positive correlation between participant and correct responses (\(r=.55,p<.001\)), indicating consistent task understanding. Additionally, qualitative findings showed that participants viewed interpolation as cleaner and more intuitive, whereas concatenation was preferred mainly due to familiarity. Readability perceptions were shaped by experience and context, with participants emphasizing the importance of clear formatting, variable highlighting, and IDE support, indicating that readability depends as much on tooling and conventions as on syntax. Conclusions. The findings suggest that literal string interpolation can enhance code readability and reduce cognitive effort during comprehension tasks. These insights have implications for programming language design and may inform future standardization of string interpolation syntax to improve code clarity and developer productivity.

Authors

Institutions

Publication Details

Journal
ACM Transactions on Computing Education
Published
2026-11-27
DOI
https://doi.org/10.1145/3872269
Primary Topic
Software Engineering Research
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
article

An Empirical Study on the Impact of String Interpolation on Program Readability and Comprehension

Daniel Ogenrwot, Andreas Stefik, John Businge
ACM Transactions on Computing Education
Software Engineering Research
article

An Empirical Study on the Impact of String Interpolation on Program Readability and Comprehension

Daniel Ogenrwot, Andreas Stefik, John Businge
article en

Abstract

Objectives. Literal string interpolation is a widely used programming language construct that allows developers to embed variables, expressions, and functions directly within strings (e.g., f‘‘Hello, {name}!’’), reducing the need for explicit concatenation. Compared to traditional concatenation, it is often considered more concise and expressive. However, its effect on program readability and comprehension remains underexplored. The objective of this study is to empirically examine how literal string interpolation influences program readability and comprehension relative to conventional string concatenation. Participants. A total of 314 participants took part in the study, representing a broad range of educational and professional stages. All participants possessed prior experience with at least one programming language, ensuring baseline familiarity with programming syntax and logic structures relevant to the study tasks. While the majority were recruited through our Department of Computer Science, additional participants were reached via a public broadcast shared on LinkedIn, which expanded recruitment beyond the immediate university community. Study Methods. We conducted a randomized controlled experiment using a within-subjects repeated-measures design. Data were collected through a custom-built experimental tool designed to present randomized programming tasks under two conditions: concatenation and interpolation. For each task, two dependent variables i.e. completion time and response correctness, were automatically recorded to measure performance and comprehension accuracy. Findings. String concatenation, particularly in complex expressions, significantly reduced program readability and increased comprehension time. A repeated-measures ANOVA revealed a significant main effect of task category, \(F(1,5026)=92.35\), \(p<.001\), \(\eta^{2}_{G}=.018\), indicating differences in completion time between concatenation and interpolation tasks. There was also a smaller but statistically significant main effect of academic level, \(F(6,5026)=2.41\), \(p=.025\), \(\eta^{2}_{G}=.003\). The interaction between task category and academic level was not significant, \(F(6,5026)=0.03\), \(p=1.00\), \(\eta^{2}_{G}=.00\), suggesting that the effect of task category was consistent across levels of academic experience. Accuracy was generally high, with a moderate positive correlation between participant and correct responses (\(r=.55,p<.001\)), indicating consistent task understanding. Additionally, qualitative findings showed that participants viewed interpolation as cleaner and more intuitive, whereas concatenation was preferred mainly due to familiarity. Readability perceptions were shaped by experience and context, with participants emphasizing the importance of clear formatting, variable highlighting, and IDE support, indicating that readability depends as much on tooling and conventions as on syntax. Conclusions. The findings suggest that literal string interpolation can enhance code readability and reduce cognitive effort during comprehension tasks. These insights have implications for programming language design and may inform future standardization of string interpolation syntax to improve code clarity and developer productivity.

ACM Transactions on Computing Education
University of Nevada, Las Vegas (US)
Software Engineering Research
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon