Optimising the fit of stack overflow code snippets into existing code

Brittany Reid, Christoph Treude, Markus Wagner

Research output: Chapter in Book/Report/Conference proceedingConference PaperResearchpeer-review

8 Citations (Scopus)

Abstract

Software developers often reuse code from online sources such as Stack Overflow within their projects. However, the process of searching for code snippets and integrating them within existing source code can be tedious. In order to improve efficiency and reduce time spent on code reuse, we present an automated code reuse tool for the Eclipse IDE (Integrated Developer Environment), NLP2TestableCode. NLP2TestableCode can not only search for Java code snippets using natural language tasks, but also evaluate code snippets based on a user's existing code, modify snippets to improve fit and correct errors, before presenting the user with the best snippet, all without leaving the editor. NLP2TestableCode also includes functionality to automatically generate customisable test cases and suggest argument and return types, in order to further evaluate code snippets. In evaluation, NLP2TestableCode was capable of finding compilable code snippets for 82.9% of tasks, and testable code snippets for 42.9%.

Original languageEnglish
Title of host publicationProceedings of the 2020 Genetic and Evolutionary Computation Conference Companion
EditorsCarlos A. Coello Coello
Place of PublicationNew York NY USA
PublisherAssociation for Computing Machinery (ACM)
Pages1945-1953
Number of pages9
ISBN (Electronic)9781450371278
DOIs
Publication statusPublished - 2020
Externally publishedYes
EventThe Genetic and Evolutionary Computation Conference 2020 - Cancun, Mexico
Duration: 8 Jul 202012 Jul 2020
Conference number: 22nd
https://gecco-2020.sigevo.org/index.html/HomePage
https://dl.acm.org/doi/proceedings/10.1145/3377930 (Proceedings)

Conference

ConferenceThe Genetic and Evolutionary Computation Conference 2020
Abbreviated titleGECCO 2020
Country/TerritoryMexico
CityCancun
Period8/07/2012/07/20
Internet address

Keywords

  • Crowd-generated code snippets
  • Optimisation
  • Stack overflow

Cite this