15 research outputs found
NLP2Code: Code Snippet Content Assist via Natural Language Tasks
Developers increasingly take to the Internet for code snippets to integrate
into their programs. To save developers the time required to switch from their
development environments to a web browser in the quest for a suitable code
snippet, we introduce NLP2Code, a content assist for code snippets. Unlike
related tools, NLP2Code integrates directly into the source code editor and
provides developers with a content assist feature to close the vocabulary gap
between developers' needs and code snippet meta data. Our preliminary
evaluation of NLP2Code shows that the majority of invocations lead to code
snippets rated as helpful by users and that the tool is able to support a wide
range of tasks.Comment: tool demo video available at
https://www.youtube.com/watch?v=h-gaVYtCznI; to appear as a tool demo paper
at ICSME 2017 (https://icsme2017.github.io/
Squirrel: A Code Snippet Repository
Teaching programming courses in an academic environment has challenges, particularly for undergraduate students. These challenges can also be found in the software industry, where novice developers still need to obtain coding training. In practice, lecturers or trainers always assign exercises to students with the goal of improving their coding skills. Based on teaching experience, we have found that students may need to rely on software development kits to code an application faster, such as reusing lines of code already developed (code snippets) to solve a particular problem. Additionally, to reduce the software development time, novice developers tend to use crowdsourcing and social media sources of example code that can be used to solve programming problems. Utilizing these code snippets not only saves time for students or novice developers but also helps them to learn. Therefore, we proposed a system, called Squirrel, that is capable of offline and online code snippet storage and searching. Additionally, for online functionalities, this application supports searching for code snippets that exist in question-and-answer websites, such as Stack Overflow. We believe that this system will help increase the effectiveness of software development, especially for computer-science students and novice developers
Mining Question and Answer Sites for Automatic Comment Generation
Code comments improve software maintainability, programming productivity, and software reliability. To address the comment scarcity issue in many projects and save developers’ time in writing comments, we propose a new, general automatic comment generation approach, which mines comments from a large programming Question and Answer (Q&A) site. Q&A sites allow programmers to post questions and receive solutions, which contain code segments together with their descriptions, referred to as code-description mappings. We develop AutoComment to extract such mappings, and leverage them to generate description comments automatically for similar code segments matched in open source projects.
We apply AutoComment to analyze 92,140 Java and Android tagged Q&A posts to extract 132,767 code-description mappings, which help AutoComment generate 102 comments automatically for 23 Java and Android projects. The number of generated comments is still low, but the user study results show that the majority of the participants consider the generated comments accurate, adequate, concise, and useful in helping them understand the code. One of the advantages from mining Q&A sites for automatic comment generation is that human written comments can provide information that is not explicitly in the code.
In the future, we would like to focus on improving both the yield and quality of the generated comments. To improve the yield, we can replace the token-based clone detection tool with one that can detect addition and reordering of lines to increase the number of code matches. To improve the quality, we can apply advanced natural language processing techniques such as semantic role labeling to analyze the semantics of the sentences, or typed dependencies to analyze the grammatical structure of the sentences
Live API Documentation
Application Programming Interfaces (APIs) provide powerful abstraction mechanisms that enable complex functionality to be used by client programs. However, this abstraction does not come for free: understanding how to use an API can be difficult. While API documentation can help, it is often insufficient on its own. Online sites like Stack Overflow and Github Gists have grown to fill the gap between traditional API documentation and more example-based resources. Unfortunately, these two important classes of documentation are independent.
This thesis describes an iterative, deductive method of linking source code examples
to API documentation. We also present an implementation of this method, called Baker, that is highly precise (0.97) and supports both Java and JavaScript. Baker can be used to
enhance traditional API documentation with up-to-date source code examples; it can also
be used to incorporate links to the API documentation into the code snippets that use the
API