arrow
Return

Sequential coding patterns: How to use them effectively in code recommendation

delete2021-12-01
delete7
PRE
AI
L
Luiz Laerte Nunes da Silva
T
Troy Kohwalter *
A
Alexandre Plastino
L
Leonardo Murta
DOI:10.1016/j.infsof.2021.106690delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
Context: Some programming constructs frequently appear together in different parts of the code, representing sequential coding patterns throughout the project. These sequential coding patterns can be mined from the project repository and, whenever the code a developer is writing coincides with the beginning of a sequential pattern, the remainder of this pattern can be suggested to the developer. This is equivalent to the usual Code Completion, which suggests syntactic structures based on the line being programmed. However, instead of providing syntactic suggestions for completing the current line, such feature suggests code snippets containing multiple lines. Objective: This paper contributes with an in-depth study on how code pattern recommendation can be used effectively. Method: We answer three research questions through a quantitative study using a robust experimental infrastructure with a corpus of five open-source projects: (1) In a code recommendation, how many frequent coding patterns should be presented?'', (2) What is the impact of filtering sequential patterns by their confidence?, and (3) Does the effectiveness of the sequential coding patterns degrade over time?''. Results: Our study shows that it is possible to achieve correctness above 80% when using suggestions with the highest confidence values and that a threshold confidence of 30% generally provides better outcomes. Furthermore, it shows that frequent code pattern completion effectiveness tends to degrade 50 commits after the patterns have been mined. Conclusion: We could observe that: (1) the top five ranked suggestions are the ones that deliver the best results; (2) the code recommendations that deliver the best results are the ones with the highest confidence values; and (3) the code recommendation performance degrades as the source code evolves because patterns become outdated.
Keywords:
Sequential code patterns
Data mining
Recommendation system
Version control system

Journal

Information and Software Technology cover
Information and Software Technology
IF:
4.3
Papers:
3.7K
Citations:
7.7K

Organization

Universidade Federal Fluminense cover
Universidade Federal Fluminense
Scholars:
9.6K
Papers: 6.4K
Citations: 4.8K