From Query to Usable Code: An Analysis of Stack Overflow Code Snippets
Not on the map. Why?
Abstract (arXiv)
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.
Key facts. Cited by 6 papers in the map (data through 7 Oct 2026). First posted on arXiv 14 May 2016.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2021: 1; 2022: 0; 2023: 2; 2024: 1; 2025: 1; 2026: 1.
6 papers.
- 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 389
- 2023Can ChatGPT replace StackOverflow? A Study on Robustness and Reliability of Large Language Model Code Generationcited by 72
- 2024Instruct or Interact? Exploring and Eliciting LLMs' Capability in Code Snippet Adaptation Through Prompt Engineeringcited by 6
- 2021Natural Language-Guided Programmingcited by 4
- 2025The Last Dependency Crusade: Solving Python Dependency Conflicts with LLMscited by 3
- 2026Coding in a Bubble? Evaluating LLMs in Resolving Context Adaptation Bugs During Code Adaptationcited by 0
- 2026Coding in a Bubble? Evaluating LLMs in Resolving Context Adaptation Bugs During Code Adaptation10 Jan 2026
- 2025The Last Dependency Crusade: Solving Python Dependency Conflicts with LLMs27 Jan 2025
- 2024Instruct or Interact? Exploring and Eliciting LLMs' Capability in Code Snippet Adaptation Through Prompt Engineering23 Nov 2024
- 2023Large Language Models for Software Engineering: A Systematic Literature Review21 Aug 2023
- 2023Can ChatGPT replace StackOverflow? A Study on Robustness and Reliability of Large Language Model Code Generation20 Aug 2023
- 2021Natural Language-Guided Programming11 Aug 2021