Analyzing and Supporting Adaptation of Online Code Examples

Developers often resort to online Q&A forums such as Stack Overflow (SO) for filling their programming needs. Although code examples on those forums are good starting points, they are often incomplete and inadequate for developers' local program contexts; adaptation of those examples is nec...

Full description

Saved in:
Bibliographic Details
Published in:Proceedings / International Conference on Software Engineering pp. 316 - 327
Main Authors: Zhang, Tianyi, Yang, Di, Lopes, Crista, Kim, Miryung
Format: Conference Proceeding
Language:English
Published: IEEE 01.05.2019
Subjects:
ISSN:1558-1225
Online Access:Get full text
Tags: Add Tag
No Tags, Be the first to tag this record!
Abstract Developers often resort to online Q&A forums such as Stack Overflow (SO) for filling their programming needs. Although code examples on those forums are good starting points, they are often incomplete and inadequate for developers' local program contexts; adaptation of those examples is necessary to integrate them to production code. As a consequence, the process of adapting online code examples is done over and over again, by multiple developers independently. Our work extensively studies these adaptations and variations, serving as the basis for a tool that helps integrate these online code examples in a target context in an interactive manner. We perform a large-scale empirical study about the nature and extent of adaptations and variations of SO snippets. We construct a comprehensive dataset linking SO posts to GitHub counterparts based on clone detection, time stamp analysis, and explicit URL references. We then qualitatively inspect 400 SO examples and their GitHub counterparts and develop a taxonomy of 24 adaptation types. Using this taxonomy, we build an automated adaptation analysis technique on top of GumTree to classify the entire dataset into these types. We build a Chrome extension called ExampleStack that automatically lifts an adaptation-aware template from each SO example and its GitHub counterparts to identify hot spots where most changes happen. A user study with sixteen programmers shows that seeing the commonalities and variations in similar GitHub counterparts increases their confidence about the given SO example, and helps them grasp a more comprehensive view about how to reuse the example differently and avoid common pitfalls.
AbstractList Developers often resort to online Q&A forums such as Stack Overflow (SO) for filling their programming needs. Although code examples on those forums are good starting points, they are often incomplete and inadequate for developers' local program contexts; adaptation of those examples is necessary to integrate them to production code. As a consequence, the process of adapting online code examples is done over and over again, by multiple developers independently. Our work extensively studies these adaptations and variations, serving as the basis for a tool that helps integrate these online code examples in a target context in an interactive manner. We perform a large-scale empirical study about the nature and extent of adaptations and variations of SO snippets. We construct a comprehensive dataset linking SO posts to GitHub counterparts based on clone detection, time stamp analysis, and explicit URL references. We then qualitatively inspect 400 SO examples and their GitHub counterparts and develop a taxonomy of 24 adaptation types. Using this taxonomy, we build an automated adaptation analysis technique on top of GumTree to classify the entire dataset into these types. We build a Chrome extension called ExampleStack that automatically lifts an adaptation-aware template from each SO example and its GitHub counterparts to identify hot spots where most changes happen. A user study with sixteen programmers shows that seeing the commonalities and variations in similar GitHub counterparts increases their confidence about the given SO example, and helps them grasp a more comprehensive view about how to reuse the example differently and avoid common pitfalls.
Author Zhang, Tianyi
Yang, Di
Kim, Miryung
Lopes, Crista
Author_xml – sequence: 1
  givenname: Tianyi
  surname: Zhang
  fullname: Zhang, Tianyi
  organization: University of California, Los Angeles
– sequence: 2
  givenname: Di
  surname: Yang
  fullname: Yang, Di
  organization: University of California, Irvine
– sequence: 3
  givenname: Crista
  surname: Lopes
  fullname: Lopes, Crista
  organization: University of California, Irvine
– sequence: 4
  givenname: Miryung
  surname: Kim
  fullname: Kim, Miryung
  organization: University of California, Los Angeles
BookMark eNotjk1Lw0AURUdRsK1du3AzfyD1vZnMF65CiFoodFFdl5dkRiLpJCQRrL_eiC4ulwOXw12yq9hFz9gdwgYR3MM2PxQbAeg2AJDqC7Z2xqIRFsFqZy_ZApWyCQqhbthyHD_mmU6dW7DHLFJ7_m7iO6dY88Nn33fD9ItZTf1EU9NF3gW-j20TPc-72vPii05968dbdh2oHf36v1fs7al4zV-S3f55m2e7hITVUyKDLdEROU2VRS-NV04pZUgFH0RqoKISJDo7JygJJmgIVcASKqHmy3LF7v-8jff-2A_NiYbz0VoUIKz8AWOvSE0
CODEN IEEPAD
ContentType Conference Proceeding
DBID 6IE
6IH
CBEJK
RIE
RIO
DOI 10.1109/ICSE.2019.00046
DatabaseName IEEE Electronic Library (IEL) Conference Proceedings
IEEE Proceedings Order Plan (POP) 1998-present by volume
IEEE Xplore All Conference Proceedings
IEEE Electronic Library (IEL)
IEEE Proceedings Order Plans (POP) 1998-present
DatabaseTitleList
Database_xml – sequence: 1
  dbid: RIE
  name: IEEE Electronic Library (IEL)
  url: https://ieeexplore.ieee.org/
  sourceTypes: Publisher
DeliveryMethod fulltext_linktorsrc
Discipline Computer Science
EISBN 9781728108698
1728108691
EISSN 1558-1225
EndPage 327
ExternalDocumentID 8812028
Genre orig-research
GroupedDBID -~X
.4S
.DC
123
23M
29O
5VS
6IE
6IF
6IH
6IK
6IL
6IM
6IN
8US
AAJGR
AAWTH
ABLEC
ADZIZ
AFFNX
ALMA_UNASSIGNED_HOLDINGS
APO
ARCSS
AVWKF
BEFXN
BFFAM
BGNUA
BKEBE
BPEOZ
CBEJK
CHZPO
EDO
FEDTE
I-F
I07
IEGSK
IJVOP
IPLJI
M43
OCL
RIE
RIL
RIO
RNS
XOL
ID FETCH-LOGICAL-a286t-3f8b19aa96ac81e37e595557a5fef2470cab03198319f5307f60fcf1b0c251223
IEDL.DBID RIE
ISICitedReferencesCount 29
ISICitedReferencesURI http://www.webofscience.com/api/gateway?GWVersion=2&SrcApp=Summon&SrcAuth=ProQuest&DestLinkType=CitingArticles&DestApp=WOS_CPL&KeyUT=000560373200028&url=https%3A%2F%2Fcvtisr.summon.serialssolutions.com%2F%23%21%2Fsearch%3Fho%3Df%26include.ft.matches%3Dt%26l%3Dnull%26q%3D
IngestDate Wed Aug 27 02:46:33 EDT 2025
IsPeerReviewed false
IsScholarly true
Language English
LinkModel DirectLink
MergedId FETCHMERGED-LOGICAL-a286t-3f8b19aa96ac81e37e595557a5fef2470cab03198319f5307f60fcf1b0c251223
PageCount 12
ParticipantIDs ieee_primary_8812028
PublicationCentury 2000
PublicationDate 2019-May
PublicationDateYYYYMMDD 2019-05-01
PublicationDate_xml – month: 05
  year: 2019
  text: 2019-May
PublicationDecade 2010
PublicationTitle Proceedings / International Conference on Software Engineering
PublicationTitleAbbrev ICSE
PublicationYear 2019
Publisher IEEE
Publisher_xml – name: IEEE
SSID ssj0006499
Score 2.2965443
Snippet Developers often resort to online Q&A forums such as Stack Overflow (SO) for filling their programming needs. Although code examples on those forums are good...
SourceID ieee
SourceType Publisher
StartPage 316
SubjectTerms Cloning
code adaptation
Java
online code examples
Production
Programming
Software engineering
Taxonomy
Title Analyzing and Supporting Adaptation of Online Code Examples
URI https://ieeexplore.ieee.org/document/8812028
WOSCitedRecordID wos000560373200028&url=https%3A%2F%2Fcvtisr.summon.serialssolutions.com%2F%23%21%2Fsearch%3Fho%3Df%26include.ft.matches%3Dt%26l%3Dnull%26q%3D
hasFullText 1
inHoldings 1
isFullTextHit
isPrint
link http://cvtisr.summon.serialssolutions.com/2.0.0/link/0/eLvHCXMwlV1LSwMxEB7a4sFT1VZ8k4NH1253Ny88SWnRSymo0FuZzU7Ey27pQ8Rfb5JdK4IXDwkhBAITkm-SzHwfwLUosMiMspHIXJVhTJHmpCOhZe7uuA7z0AaxCTmdqvlcz1pws8uFIaIQfEa3vhn-8ovKbP1T2UA5NHJ42Ia2lKLO1dqdusK57g11zzDWg8fR09gHbulAxyl-aacE6Jh0_zfpAfR_cvDYbIcuh9Ci8gi63yIMrNmTPbgLtCKfbgzDsmBepbPyzACv7L7AZf3RzirLak5RNqoKYuMP9KTA6z68TMbPo4eoUUSIMFFiE6VWOQsiaoFGDSmVxDXnXCK3ZJNMxgZzn5akXLHcbV8rYmvsMI-N92OS9Bg6ZVXSCbAc4zS3zv-SAjPSiVImRtIpFySsUXQKPW-LxbImvVg0Zjj7u_sc9r2x60jAC-hsVlu6hD3zvnlbr67CSn0BJmWVEw
linkProvider IEEE
linkToHtml http://cvtisr.summon.serialssolutions.com/2.0.0/link/0/eLvHCXMwlV1NSwMxEB1qFfRUtRW_zcGjq-lukk3wJKWlxVoKVuitZLMT8bJb-iHirzfZXSuCFw8JIQQCE5I3SWbeA7gWqU6ZkTYQzFVMUwwURxUIFSfujuswT9tCbCIejeR0qsY1uNnkwiBiEXyGt75Z_OWnuVn7p7I76dDI4eEWbHPGQlpma23OXeGc94q8p03V3aDz3PWhW6og5BS_1FMK8Og1_jftPrR-svDIeIMvB1DD7BAa3zIMpNqVTbgviEU-3Riis5R4nc7ccwO8kodUz8uvdpJbUrKKkk6eIul-aE8LvGzBS6876fSDShMh0KEUqyCy0tlQayW0kW2MYuSKcx5rbtGGLKZGJz4xSbpiudvAVlBrbDuhxnsyYXQE9SzP8BhIommUWOeBxUIzVKGUhmpUERcorJF4Ak1vi9m8pL2YVWY4_bv7Cnb7k6fhbDgYPZ7Bnjd8GRd4DvXVYo0XsGPeV2_LxWWxal8Yy5ha
openUrl ctx_ver=Z39.88-2004&ctx_enc=info%3Aofi%2Fenc%3AUTF-8&rfr_id=info%3Asid%2Fsummon.serialssolutions.com&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=proceeding&rft.title=Proceedings+%2F+International+Conference+on+Software+Engineering&rft.atitle=Analyzing+and+Supporting+Adaptation+of+Online+Code+Examples&rft.au=Zhang%2C+Tianyi&rft.au=Yang%2C+Di&rft.au=Lopes%2C+Crista&rft.au=Kim%2C+Miryung&rft.date=2019-05-01&rft.pub=IEEE&rft.eissn=1558-1225&rft.spage=316&rft.epage=327&rft_id=info:doi/10.1109%2FICSE.2019.00046&rft.externalDocID=8812028