Abstract

A code snippet is a small region of reusable source code that is common to many functions. Skilled management and reuse of snippets can improve programming efficiency in practice. However, we find that most snippets are posted to online blogs or snippet management systems with little description and tagging, which leads to an embarrassing situation in which existing snippets are difficult to reuse. This occurs because snippets are usually hastily pushed to online services or saved in text files by programmers and also because existing management systems do not provide efficient labeling and reusing frameworks. In this paper, we propose to annotate snippets with a well-formed domain-specific ontology—programming ontology. With a thorough investigation of real world snippets, we designed a programming ontology to annotate and recommend snippets. We show how to annotate a snippet with ontology terms based on text classification models. In addition, we built a snippet management system that stores user snippets in the cloud and automatically recommends snippets, so that the retrieval of snippets becomes trivial in popular integrated developing environments, such as Eclipse and Visual Studio. Our evaluation results demonstrate that the ontology annotation algorithm is able to automatically annotate a snippet with a high degree of accuracy. The shared domain knowledge also makes it possible to share snippets among programmers and systems. As the number of labeled snippets increases, deep learning models can be trained and used to annotate code snippets with high accuracy.

Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.