TY - JOUR
T1 - The last line effect explained
AU - Beller, Moritz
AU - Zaidman, Andy
AU - Karpov, Andrey
AU - Zwaan, Rolf A.
PY - 2017/6
Y1 - 2017/6
N2 - Micro-clones are tiny duplicated pieces of code; they typically comprise only few statements or lines. In this paper, we study the “Last Line Effect,” the phenomenon that the last line or statement in a micro-clone is much more likely to contain an error than the previous lines or statements. We do this by analyzing 219 open source projects and reporting on 263 faulty micro-clones and interviewing six authors of real-world faulty micro-clones. In an interdisciplinary collaboration, we examine the underlying psychological mechanisms for the presence of these relatively trivial errors. Based on the interviews and further technical analyses, we suggest that so-called “action slips” play a pivotal role for the existence of the last line effect: Developers’ attention shifts away at the end of a micro-clone creation task due to noise and the routine nature of the task. Moreover, all micro-clones whose origin we could determine were introduced in unusually large commits. Practitioners benefit from this knowledge twofold: 1) They can spot situations in which they are likely to introduce a faulty micro-clone and 2) they can use PVS-Studio, our automated micro-clone detector, to help find erroneous micro-clones.
AB - Micro-clones are tiny duplicated pieces of code; they typically comprise only few statements or lines. In this paper, we study the “Last Line Effect,” the phenomenon that the last line or statement in a micro-clone is much more likely to contain an error than the previous lines or statements. We do this by analyzing 219 open source projects and reporting on 263 faulty micro-clones and interviewing six authors of real-world faulty micro-clones. In an interdisciplinary collaboration, we examine the underlying psychological mechanisms for the presence of these relatively trivial errors. Based on the interviews and further technical analyses, we suggest that so-called “action slips” play a pivotal role for the existence of the last line effect: Developers’ attention shifts away at the end of a micro-clone creation task due to noise and the routine nature of the task. Moreover, all micro-clones whose origin we could determine were introduced in unusually large commits. Practitioners benefit from this knowledge twofold: 1) They can spot situations in which they are likely to introduce a faulty micro-clone and 2) they can use PVS-Studio, our automated micro-clone detector, to help find erroneous micro-clones.
KW - Clone detection
KW - Code clones
KW - Interdisciplinary work
KW - Last line effect
KW - Micro-clones
KW - Psychology
UR - http://resolver.tudelft.nl/uuid://6df-e66b-4f06-8a65-a71de350a859
UR - http://www.scopus.com/inward/record.url?scp=85007482467&partnerID=8YFLogxK
U2 - 10.1007/s10664-016-9489-6
DO - 10.1007/s10664-016-9489-6
M3 - Article
AN - SCOPUS:85007482467
SN - 1382-3256
VL - 22
SP - 1508
EP - 1536
JO - Empirical Software Engineering
JF - Empirical Software Engineering
IS - 3
ER -