arXiv · 2611.39048
An Empirical Study on the Impact of String Interpolation on Program Readability and Comprehension
Abstract
Literal string interpolation lets developers embed variables, expressions, and function calls within strings (e.g., f"Hello, {name}!"), reducing the need for explicit concatenation. Although often considered more concise and expressive than concatenation, its effect on program readability and comprehension remains underexplored. We report a randomized controlled experiment with a within-subjects repeated-measures design in which 314 participants with prior programming experience, recruited mainly through a university computer science department and LinkedIn, completed randomized programming tasks under two conditions: concatenation and interpolation. A custom-built tool automatically recorded completion time and response correctness. Participants took longer on concatenation tasks, particularly for complex expressions. A repeated-measures ANOVA revealed a significant main effect of task category on completion time, F(1, 5026) = 92.35, p < .001, $η^2_G$ = .018, and a smaller main effect of academic level, F(6, 5026) = 2.41, p = .025, $η^2_G$ = .003. The interaction was not significant, F(6, 5026) = 0.03, p = 1.00, showing that the effect of task category was consistent across academic levels. Accuracy was high, with a moderate positive correlation between participant and correct responses (r = .55, p < .001). Qualitatively, participants described interpolation as cleaner and more intuitive, whereas preference for concatenation was driven mainly by familiarity. Participants also emphasized clear formatting, variable highlighting, and IDE support, suggesting that readability depends on tooling and conventions as well as syntax. The findings suggest that literal string interpolation can enhance code readability and reduce cognitive effort during comprehension, with implications for programming language design and the standardization of interpolation syntax.
Explore related subjects
Keep this discovery
Explore connections, maps & timelines
Daniel Ogenrwot, John Businge, Andreas Stefik. 2026-11-28. An Empirical Study on the Impact of String Interpolation on Program Readability and Comprehension. https://doi.org/10.1145/3872269. https://arxiv.science/abs/2611.39048
Citations retain the original authors and DOI and include this site’s record URL. If this discovery service contributed to your research, you can also cite arXiv Science by Indiciae: BibTeX · RIS.