SEMay 14, 2016

From Query to Usable Code: An Analysis of Stack Overflow Code Snippets

arXiv:1605.04464v1119 citations
Originality Synthesis-oriented
AI Analysis

This work addresses the problem of leveraging Stack Overflow for automated code generation tools, but it is incremental as it focuses on analysis rather than developing new methods.

The paper analyzed 3 million Stack Overflow code snippets across four languages to assess their usability for automated tools, finding Python and JavaScript had the highest usability rates while Java and C# had the lowest, and investigated how natural language annotations align with usability for future program generation.

Enriched by natural language texts, Stack Overflow code snippets are an invaluable code-centric knowledge base of small units of source code. Besides being useful for software developers, these annotated snippets can potentially serve as the basis for automated tools that provide working code solutions to specific natural language queries. With the goal of developing automated tools with the Stack Overflow snippets and surrounding text, this paper investigates the following questions: (1) How usable are the Stack Overflow code snippets? and (2) When using text search engines for matching on the natural language questions and answers around the snippets, what percentage of the top results contain usable code snippets? A total of 3M code snippets are analyzed across four languages: C\#, Java, JavaScript, and Python. Python and JavaScript proved to be the languages for which the most code snippets are usable. Conversely, Java and C\# proved to be the languages with the lowest usability rate. Further qualitative analysis on usable Python snippets shows the characteristics of the answers that solve the original question. Finally, we use Google search to investigate the alignment of usability and the natural language annotations around code snippets, and explore how to make snippets in Stack Overflow an adequate base for future automatic program generation.

Foundations

The foundational work for this paper's niche, ranked by how specifically the neighbourhood builds on it — not by global fame.

Your Notes