The last line effect explained

Journal Article (2017)
Author(s)

Moritz Beller (TU Delft - Software Engineering)

Andy Zaidman (TU Delft - Software Engineering)

Andrey Karpov (OOO 'Program Verification Systems')

Rolf A. Zwaan ( Erasmus Universiteit Rotterdam)

Research Group
Software Engineering
Copyright
© 2017 M.M. Beller, A.E. Zaidman, Andrey Karpov, Rolf A. Zwaan
DOI related publication
https://doi.org/10.1007/s10664-016-9489-6
More Info
expand_more
Publication Year
2017
Language
English
Copyright
© 2017 M.M. Beller, A.E. Zaidman, Andrey Karpov, Rolf A. Zwaan
Research Group
Software Engineering
Issue number
3
Volume number
22
Pages (from-to)
1508-1536
Reuse Rights

Other than for strictly personal use, it is not permitted to download, forward or distribute the text or part of it, without the consent of the author(s) and/or copyright holder(s), unless the work is under an open content license such as Creative Commons.

Abstract

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.