What Information About Code Snippets Is Available in Different Software-Related Documents? an Exploratory Study

What Information About Code Snippets Is Available in Different Software-Related Documents? an Exploratory Study

What Information about Code Snippets Is Available in Different Software-Related Documents? An Exploratory Study Preetha Chatterjee∗, Manziba Akanda Nishiy, Kostadin Damevskiy, Vinay Augustinez, Lori Pollock∗ and Nicholas A. Kraftz ∗ University of Delaware, Newark, DE, USA Email: fpreethac, [email protected] y Virginia Commonwealth University, Richmond, VA, USA Email: fnishima, [email protected] zABB Corporate Research, Raleigh, NC, USA Email: fvinay.augustine, [email protected] Abstract—A large corpora of software-related documents is While individual developers can learn from the afore- available on the Web, and these documents offer the unique mentioned sources, the publicly available, large corpora of opportunity to learn from what developers are saying or asking software-related documents also provide the opportunity to about the code snippets that they are discussing. For example, the natural language in a bug report provides information about what automatically learn common API behaviors, properties, and is not functioning properly in a particular code snippet. Previous vulnerabilities, as well as to complement similar information research has mined information about code snippets from bug learned by mining software repositories. Researchers have reports, emails, and Q&A forums. This paper describes an performed empirical analysis of developer communications exploratory study into the kinds of information that is embedded in order to understand specific software enclaves or novel in different software-related documents. The goal of the study is to gain insight into the potential value and difficulty of mining techniques used by developers in the field, for instance, exam- the natural language text associated with the code snippets found ining modern code reviews using tools like Gerrit [1], or the in a variety of software-related documents, including blog posts, information encoded in tutorials for mobile development [2]. API documentation, code reviews, and public chats. The captured insights can be integrated into the development of new models and analyses to enhance software engineering I. INTRODUCTION techniques and tools. The knowledge that can be gained from these sources is Integrated development environments today include sophis- typically embedded in the natural language describing the code ticated program modeling and analyses behind the scenes or the properties it exhibits. For example, the natural language to support the developer in navigating, understanding, and might note that the code is a good example of a correct, modifying their code. While much can be learned from results efficient, or secure solution to a particular problem, or that the of static and dynamic analysis of their source code, developers code exemplifies a common code bug, security vulnerability, also look to others for advice and learning. As software or energy bug to avoid, possibly in a particular context. development teams are more globally distributed and the open Researchers have also developed analyses to mine various source community has grown, developers rely increasingly information from the natural language text surrounding code on written documents for help they might have previously snippets in emails [3], [4], bug reports [3], Q & A forums [5], obtained through in-person conversations. [6], [7], and tutorials [8]. For example, Panichella et al. [3] Developer communications (e.g., developer blog posts, bug developed a feature-based approach to automatically extract reports, API documentation, mailing lists, code reviews, and method descriptions from bug tracking systems and mailing question & answer forums) offer the unique opportunity to lists. Vassallo et al. [5] built on their previous work [3] to learn from what the developers are saying or asking about design a tool called CODES that extracts candidate method the code snippets they are discussing. E-books, online course documentation from StackOverflow discussions and creates materials, videos, and programming manuals offer learning Javadoc descriptions. Wong et al. [6] mine comments from opportunities, often explaining concepts using code examples. Stack Overflow by extracting text preceding code snippets Similarly, technical presentations and research papers often and using the code-description mappings in the posts to use code examples to demonstrate challenges addressed by automatically generate descriptive comments for similar code their work. Developers can also learn from code in benchmark snippets matched in open-source projects. Collectively, these suites, standards documents, and code snippets from reposito- efforts demonstrate the potential for extracting and using ries such as GitHub Gists and Pastebin. information embedded in natural language text of software- related documents for software engineering tools. They also TABLE I raise the questions of what other kinds of information can SUBJECTS OF STUDY be extracted from these particular types of documents and of Document Type Example Origin Unit of Analysis what kinds of information can be extracted from other types Blog Posts MSDN, Personal blogs Individual blog posts of software-related documents. Benchmarks OpenMP NAS One chapter or section This paper describes an exploratory study that investigates Bug Reports GitHub Issues, Contents of an issue the following questions: Bugzilla 1) What are the characteristics of the code snippets embed- Code reviews GitHub Pull Requests, One pull request ded in different types of software-related documents? Gerrit 2) What kind of information is available in each document Course materials cs.*.edu One PDF type? Which document types provide similar informa- Documentation readthedocs.org One documentation page or API tion? Which information is most readily available across E-Books WikiBooks Used single book all document types? chapter 3) What are the cues that indicate code snippet related Mailing lists lkml.org One conversation information? How do the cues differ across different thread document types? What influential words/phrases indicate Papers ACM Digital Library, Complete paper the different kinds of information in different document IEEE Xplore types? Presentations SlideShare Entire slide deck Public Chat Gitter, Slack Single conversation Our results provide preliminary indications regarding the with related snippets document types that would serve as the most fruitful sources Q&A sites StackOverflow, MSDN Single question plus for different kinds of information, and also provide insights answers into what cues might help in automatically extracting that information. them from only the contextual information in the documents. Redaction was performed using the redaction tools in Adobe II. METHODOLOGY Acrobat. Annotators were given documents with each line of Figure 1 depicts the major steps of our exploratory study. a code snippet blacked out or covered entirely with a black After selecting a set of documents of each document type rectangle. We did not redact small code snippets that were under investigation, we redacted the code snippets, and asked embedded within paragraphs of text. human annotators to make as many observations about what they could learn about the missing code snippets strictly from B. Identifying Code Snippet-related Information the text and also to highlight the text on which they based We assigned 37 documents to 35 annotators. The annotators their observations. We then developed a labeling scheme to comprised 20 undergraduate, 13 graduate, and 2 professional code the observations and analyzed both the codings and other researchers, all with prior programming experience. We as- information gained from the frequency and sizes of the code signed each annotator 3 documents to review. All of the snippets across different document types. Figure 2 provides an documents were assigned to multiple annotators to review. illustrative example of steps 1–3. We received 59 responses from 19 of the annotators (8 undergraduate, 11 graduate, 2 professional). The annotators 1 2 3 4 submitted 49 reviews of 31 distinct documents, constituting documents redact identify code the analyze study of 12 types code code- identified snippets and results of 2-4 documents of each type. 14 of these documents were snippets related text content coded text annotated by multiple people, and in these cases we merged the observations from different annotators. Each annotator was asked to enumerate as many obser- Fig. 1. Methodology Procedure vations as possible about the redacted code snippets. They also indicated which code snippet they believed was being A. Subjects of Study described when there were multiple redacted code snippets Table I specifies the 12 document types that we studied, in the same document. They highlighted the text from which some example sources from which we sampled the documents, they made each observation. Thus, they created an implicit and the unit of granularity that we studied for each document mapping between code snippet, related text, and observation type. We collected 60 document instances, with at least two from that text. The annotators made 322 observations in total. instances for each type. We randomly selected document instances from 51 distinct sources, all well known, popular C. Coding the Identified Relevant Text sites or high-profile projects. We excluded documents that had Two of the authors identified core code properties that no code snippets. were mentioned throughout the annotators’ observations. We After assembling the corpus,

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    5 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us