How are functionally similar code clones different?

A pre-print of a study on the differences between functionally similar code clones just became available at PeerJ. Please have a look. We are looking forward to comments, feedback and questions here or on the pre-print page.

We used solutions to programming problems of Google Code Jam. The solutions to a programming problem have to be functionally similar. Therefore, we can consider them functionally similar clones  (i.e. the code fragments provide similar functionality but are not necessarily syntactically similar). Clones with similar functionality, usually the result of copy & paste, can be found reliably with contemporary clone detection tools. Functionally similar clones, however, are still a large challenge.

We used the clone detection functionality in ConQAT to investigate how much syntactic similarity is there in these functionally similar code clones. They probably have not been created by copy & paste. We found that the syntactic similarity is below 16 %; often it is much smaller. To better understand the remaining differences, we categorised them manually. We found differences in the algorithms, data structures, OO design, I/O and the usage of libraries.

We provide based on this categorisation a freely available benchmark representing these differences along with all the data used in the study. We hope this helps the clone detection research community to move the detection of functionally similar code clones forward.

We are looking forward to your comments and feedback!

Source: https://peerj.com/preprints/1516/?td=bl