How do developers utilize source code from stack overflow?

被引:0
|
作者
Yuhao Wu
Shaowei Wang
Cor-Paul Bezemer
Katsuro Inoue
机构
[1] Osaka University,Graduate School of Information Science and Technology
[2] Queen’s University,SAIL
来源
关键词
Stack Overflow Posts; Source Code Reuse; Enhancement Information; Outdated Code; Code Quality;
D O I
暂无
中图分类号
学科分类号
摘要
Technical question and answer Q&A platforms, such as Stack Overflow, provide a platform for users to ask and answer questions about a wide variety of programming topics. These platforms accumulate a large amount of knowledge, including hundreds of thousands lines of source code. Developers can benefit from the source code that is attached to the questions and answers on Q&A platforms by copying or learning from (parts of) it. By understanding how developers utilize source code from Q&A platforms, we can provide insights for researchers which can be used to improve next-generation Q&A platforms to help developers reuse source code fast and easily. In this paper, we first conduct an exploratory study on 289 files from 182 open-source projects, which contain source code that has an explicit reference to a Stack Overflow post. Our goal is to understand how developers utilize code from Q&A platforms and to reveal barriers that may make code reuse more difficult. In 31.5% of the studied files, developers needed to modify source code from Stack Overflow to make it work in their own projects. The degree of required modification varied from simply renaming variables to rewriting the whole algorithm. Developers sometimes chose to implement an algorithm from scratch based on the descriptions from Stack Overflow answers, even if there was an implementation readily available in the post. In 35.5% of the studied files, developers used Stack Overflow posts as an information source for later reference. To further understand the barriers of reusing code and to obtain suggestions for improving the code reuse process on Q&A platforms, we conducted a survey with 453 open-source developers who are also on Stack Overflow. We found that the top 3 barriers that make it difficult for developers to reuse code from Stack Overflow are: (1) too much code modification required to fit in their projects, (2) incomprehensive code, and (3) low code quality. We summarized and analyzed all survey responses and we identified that developers suggest improvements for future Q&A platforms along the following dimensions: code quality, information enhancement & management, data organization, license, and the human factor. For instance, developers suggest to improve the code quality by adding an integrated validator that can test source code online, and an outdated code detection mechanism. Our findings can be used as a roadmap for researchers and developers to improve code reuse.
引用
收藏
页码:637 / 673
页数:36
相关论文
共 50 条
  • [1] How do developers utilize source code from stack overflow?
    Wu, Yuhao
    Wang, Shaowei
    Bezemer, Cor-Paul
    Inoue, Katsuro
    [J]. EMPIRICAL SOFTWARE ENGINEERING, 2019, 24 (02) : 637 - 673
  • [2] How Do Developers Document Database Usages in Source Code?
    Linares-Vasquez, Mario
    Li, Boyang
    Vendome, Christopher
    Poshyvanyk, Denys
    [J]. 2015 30TH IEEE/ACM INTERNATIONAL CONFERENCE ON AUTOMATED SOFTWARE ENGINEERING (ASE), 2015, : 36 - 41
  • [3] What Do Developers Use the Crowd For? A Study Using Stack Overflow
    Abdalkareem, Rabe
    Shihab, Emad
    Rilling, Juergen
    [J]. IEEE SOFTWARE, 2017, 34 (02) : 53 - 60
  • [4] How Developers Discuss Architecture Smells? An Exploratory Study on Stack Overflow
    Tian, Fangchao
    Liang, Peng
    Babar, Muhammad Ali
    [J]. 2019 IEEE INTERNATIONAL CONFERENCE ON SOFTWARE ARCHITECTURE (ICSA), 2019, : 91 - 100
  • [5] How Developers and Tools Categorize Sentiment in Stack Overflow Questions - A Pilot Study
    Mansoor, Niloofar
    Peterson, Cole S.
    Sharif, Bonita
    [J]. 2021 IEEE/ACM SIXTH INTERNATIONAL WORKSHOP ON EMOTION AWARENESS IN SOFTWARE ENGINEERING SEMOTION 2021, 2021, : 19 - 22
  • [6] Do Developers Really Know How to Use Git Commands? A Large-scale Study Using Stack Overflow
    Yang, Wenhua
    Zhang, Chong
    Pan, Minxue
    Xu, Chang
    Zhou, Yu
    Huang, Zhiqiu
    [J]. ACM TRANSACTIONS ON SOFTWARE ENGINEERING AND METHODOLOGY, 2022, 31 (03)
  • [7] Code Duplication on Stack Overflow
    Baltes, Sebastian
    Treude, Christoph
    [J]. 2020 IEEE/ACM 42ND INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING: NEW IDEAS AND EMERGING RESULTS (ICSE-NIER 2020), 2020, : 13 - 16
  • [8] How Do Developers Refactor Code to Improve Code Reusability?
    AlOmar, Eman Abdullah
    Rodriguez, Philip T.
    Bowman, Jordan
    Wang, Tianjia
    Adepoju, Benjamin
    Lopez, Kevin
    Newman, Christian
    Ouni, Ali
    Mkaouer, Mohamed Wiem
    [J]. REUSE IN EMERGING SOFTWARE ENGINEERING PRACTICES, ICSR 2020, 2020, 12541 : 261 - 276
  • [9] What skills do IT companies look for in new developers? A study with Stack Overflow jobs
    Montandon, Joao Eduardo
    Politowski, Cristiano
    Silva, Luciana Lourdes
    Valente, Marco Tulio
    Petrillo, Fabio
    Gueheneuc, Yann-Gael
    [J]. INFORMATION AND SOFTWARE TECHNOLOGY, 2021, 129
  • [10] Detecting Duplicate Questions in Stack Overflow via Source Code Modeling
    Gao, Wei
    Wu, Jian
    Xu, Guandong
    [J]. INTERNATIONAL JOURNAL OF SOFTWARE ENGINEERING AND KNOWLEDGE ENGINEERING, 2022, 32 (02) : 227 - 255