Replacements and Replaceables: Making the Case for Code Variants
Venkatesh Vinayakarao, Devika Sondhi, Sumit Keswani, Rahul Purandare,, Anita Sarma

TL;DR
This paper characterizes code variants, a specific type of similar code snippets differing by properties, highlighting their prevalence in developer discussions and demonstrating how understanding them can improve search result ranking.
Contribution
It provides a formal characterization of code variants, distinguishes them from other redundancies, and shows their significance in developer discussions and potential for enhanced code search.
Findings
25% to 43% of developer discussions involve variants
Different types of variants are characterized based on context and properties
Search results can be ranked effectively using variant properties
Abstract
There are often multiple ways to implement the same requirement in source code. Different implementation choices can result in code snippets that are similar, and have been defined in multiple ways: code clones, examples, simions and variants. Currently, there is a lack of a consistent and unambiguous definition of such types of code snippets. Here we present a characterization study of code variants - a specific type of code snippets that differ from each other by at least one desired property, within a given code context. We distinguish code variants from other types of redundancies in source code, and demonstrate the significant role that they play: about 25% to 43% of developer discussions (in a set of nine open source projects) were about variants. We characterize different types of variants based on their code context and desired properties. As a demonstration of the possible use…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Software System Performance and Reliability · Software Reliability and Analysis Research
