The Last Line Effect

Andrey Karpov has an interesting post that explores a surprising conclusion. Karpov studies errors in computer code professionally for his company Viva64. The company makes the static code analysers PVS-Studio and CppCat. Karpov studies different code bases and writes about the bugs he found.

One day, he noticed that he was using the words “note the last line” quite often and wondered why. He studied the reports that he used the phrase in and discovered what he calls The Last Line Effect. He found that when programmers copied and pasted nearly identical lines in a block of code, the error was much more likely to occur in the last line than the previous ones.

One of the interesting things from the post is that he give examples of real code bases such as Chromium, ReactOS, Qt, Firefox, OpenSSL, and many others. It’s interesting to see the last line effect in action.

It’s a very nice post and well worth a few minutes of your time. Give it a read.

This entry was posted in Programming. Bookmark the permalink.