An Empirical Study on the Impact of String Interpolation on Program Readability and Comprehension
Daniel Ogenrwot, John Businge, Andreas Stefik
Key points
From the paper's conclusion- The findings suggest that literal string interpolation can enhance code readability and reduce cognitive effort during comprehension tasks.
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.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Prompt literacy of future computer science teachers in solving and debugging programming tasks with ChatGPT: perceptions, practices, and academic performance patternsFrontiers in Education · 2026
- Growing One's AI Tools: A Paradigm of Practice-Grown ToolsarXiv · 2026
- Adapt the Object to the Subject: Representative Study Material for Empirical Software EngineeringarXiv · 2026
- Executable Human Study Programs with Silicon ParticipantsarXiv · 2026
- Novices Comprehending Functional vs. Imperative Programs: An Eye-Tracking StudyACM Transactions on Software Engineering and Methodology · 2026
- Comprehending Python Repetition Structures: An Eye-Tracking Study with Novice DevelopersarXiv · 2026