Nothing Special   »   [go: up one dir, main page]

skip to main content
10.1145/3173574.3173659acmconferencesArticle/Chapter ViewAbstractPublication PageschiConference Proceedingsconference-collections
research-article
Open access

Interactive Extraction of Examples from Existing Code

Published: 19 April 2018 Publication History

Abstract

Programmers frequently learn from examples produced and shared by other programmers. However, it can be challenging and time-consuming to produce concise, working code examples. We conducted a formative study where 12 participants made examples based on their own code. This revealed a key hurdle: making meaningful simplifications without introducing errors. Based on this insight, we designed a mixed-initiative tool, CodeScoop, to help programmers extract executable, simplified code from existing code. CodeScoop enables programmers to "scoop" out a relevant subset of code. Techniques include selectively including control structures and recording an execution trace that allows authors to substitute literal values for code and variables. In a controlled study with 19 participants, CodeScoop helped programmers extract executable code examples with the intended behavior more easily than with a standard code editor.

Supplementary Material

ZIP File (pn1561.zip)
suppl.mov (pn1561-file5.mp4)
Supplemental video
suppl.mov (pn1561.mp4)
Supplemental video

References

[1]
Java Debug Interface. https://docs.oracle.com/javase/7/docs/jdk/api/jpda/jdi/
[2]
WALA: T. J. Watson Libraries for Analysis. http://wala.sourceforge.net
[3]
Paul Anderson and Tim Teitelbaum. Software inspection using CodeSurfer. In Workshop on Inspection in Software Engineering (WISE) '01. 4--11.
[4]
Titus Barik, Yoonki Song, Brittany Johnson, and Emerson Murphy-Hill. From quick fixes to slow fixes: Reimagining static analysis resolutions to enable design space exploration. In ICSME '16. 211--221.
[5]
Andrew Bragdon, Robert Zeleznik, Steven P. Reiss, Suman Karumuri, William Cheung, Joshua Kaplan, Christopher Coleman, Ferdi Adeputra, and Joseph J. LaViola Jr. Code bubbles: A working set-based interface for code understanding and maintenance. In CHI '10. 2503--2512.
[6]
Joel Brandt, Mira Dontcheva, Marcos Weskamp, and Scott R. Klemmer. Example-centric programming: Integrating web search into the development environment. In CHI '10. 513--522.
[7]
Raymond P. L. Buse and Westley Weimer. Synthesizing API usage examples. In ICSE '12. 782--792.
[8]
Zhifei Chen, Lin Chen, Yuming Zhou, Zhaogui Xu, William C. Chu, and Baowen Xu. Dynamic slicing of Python programs. In COMPSAC '14. 219--228.
[9]
Pascal Cuoq, Florent Kirchner, Nikolai Kosmatov, Virgile Prevosto, Julien Signoles, and Boris Yakobowski. Frama-C: A Software Analysis Perspective. In SEFM '12. 233--247.
[10]
Shiry Ginosar, Luis Fernando De Pombo, Maneesh Agrawala, and Björn Hartmann. Authoring multi-stage code examples with editable code histories. In UIST '13. 485--494.
[11]
Elena L. Glassman, Tianyi Zhang, Björn Hartmann, and Miryung Kim. Visualizing API Usage Examples at Scale. In CHI '18. To appear.
[12]
Raphael Hoffmann, James Fogarty, and Daniel S. Weld. Assieme: Finding and leveraging implicit references in a web search interface for programmers. In UIST '07. 13--22.
[13]
Ganeshan Jayaraman, Venkatesh Prasad Ranganath, and John Hatcliff. Kaveri: Delivering the Indus Java program slicer to Eclipse. In FASE '05. 269--272.
[14]
Chris Kojouharov, Aleksey Solodovnik, and Gleb Naumovich. JTutor: An Eclipse plug-in suite for creation and replay of code-based tutorials. In OOPSLA '04. 27--31.
[15]
Jens Krinke. Visualization of program dependence and slices. In ICSM '04. 168--177.
[16]
João Eduardo Montandon, Hudson Borges, Daniel Felix, and Marco Tulio Valente. Documenting APIs with examples: Lessons learned with the APIMiner platform. In WCRE '13. 401--408.
[17]
Laura Moreno, Gabriele Bavota, Massimiliano Di Penta, Rocco Oliveto, and Andrian Marcus. How Can I Use This Method?. In ICSE '15. 880--890.
[18]
Seyed Mehdi Nasehi and Frank Maurer. Unit tests as API usage examples. In ICSM '10. 1--10.
[19]
Seyed Mehdi Nasehi, Jonathan Sillito, Frank Maurer, and Chris Burns. What makes a good code example? A study of programming Q&A in StackOverflow. In ICSM '12. 25--34.
[20]
Janet Nykaza, Rhonda Messinger, Fran Boehme, Cherie L. Norman, Matthew Mace, and Manuel Gordon. 2002. What programmers really want: Results of a needs assessment for SDK documentation. In SIGDOC '02. 133--141.
[21]
Christopher Oezbek and Lutz Prechelt. JTourBus: Simplifying program understanding by documentation that provides tours through the source code. In ICSM '07. 64--73.
[22]
Stephen Oney and Joel Brandt. Codelets: Linking interactive documentation and example code in the editor. In CHI '12. 2697--2706.
[23]
Chris Parnin, Christoph Treude, Lars Grammel, and Margaret-Anne Storey. 2012. Crowd documentation: Exploring the coverage and the dynamics of API discussions on Stack Overflow. Technical Report.
[24]
Chris Parnin, Christoph Treude, and Margaret-Anne Storey. Blogging developer knowledge: Motivations, challenges, and future directions. In ICPC '13. 211--214.
[25]
T. J. Parr and R. W. Quong. 1995. ANTLR: A Predicated-LL(k) Parser Generator. Software - Practice and Experience 25, 7 (1995), 789--810.
[26]
Michael Pradel, Ciera Jaspan, Jonathan Aldrich, and Thomas R. Gross. Statically checking API protocol conformance with mined multi-object specifications. In ICSE '12. 925--935.
[27]
Martin P. Robillard. 2009. What makes APIs hard to learn? Answers from developers. IEEE Software 26, 6 (Nov. 2009), 27--34.
[28]
Martin P. Robillard and Robert Deline. 2011. A field study of API learning obstacles. Empirical Software Engineering 16, 6 (Dec. 2011), 703--732.
[29]
Marc Sacks. 1994. On-the-Job Learning in the Software Industry. Corporate Culture and the Acquisition of Knowledge. Greenwood Publishing Group, Inc.
[30]
S M Sohan, Craig Anslow, and Frank Maurer. SpyREST: Automated RESTful API documentation using an HTTP proxy server. In ASE '15. 271--276.
[31]
Jeffrey Stylos and Brad A. Myers. Mica: A web-search tool for finding API components and examples. In VL/HCC '06. 195--202.
[32]
Frank Tip. 1995. A survey of program slicing techniques. Journal of Programming Languages 3, 3 (1995), 121--189.
[33]
Christoph Treude, Ohad Barzilay, and Margaret-Anne Storey. 2011. How do programmers ask and answer questions on the web?. In ICSE '11 NIER track. 804--807.
[34]
Christoph Treude and Martin P. Robillard. Understanding Stack Overflow code fragments. In ICSME '17. 509--513.
[35]
Mohsen Vakilian, Nicholas Chen, Stas Negara, Balaji Ambresh Rajkumar, Brian P. Bailey, and Ralph E. Johnson. Use, disuse, and misuse of automated refactorings. In ICSE '12. 233--243.
[36]
Mohsen Vakilian, Stas Negara, Samira Tasharofi, and Ralph E Johnson. Keshmesh: A tool for detecting and fixing Java concurrency bug patterns. In SPLASH '11. 39--40.
[37]
Raja Vallée-Rai, Phong Co, Etienne Gagnon, Laurie Hendren, Patrick Lam, and Vijay Sundaresan. Soot: A Java bytecode optimization framework. In CASCON '99.
[38]
Doug Wightman, Zi Ye, Joel Brandt, and Roel Vertegaal. SnipMatch: Using source code context to enhance snippet retrieval and parameterization. In UIST '12. 219--228.
[39]
Hongyu Zhang, Anuj Jain, Gaurav Khandelwal, Chandrashekhar Kaushik, Scott Ge, and Wenxiang Hu. Bing Developer Assistant: Improving developer productivity by recommending sample code. In FSE '16. 956--961.
[40]
Zixiao Zhu, Yanzhen Zou, Bing Xie, Yong Jin, Zeqi Lin, and Lu Zhang. Mining API usage examples from test code. In ICSME '14. 301--310.

Cited By

View all
  • (2024)Do LLMs Meet the Needs of Software Tutorial Writers? Opportunities and Design ImplicationsProceedings of the 2024 ACM Designing Interactive Systems Conference10.1145/3643834.3660692(1760-1773)Online publication date: 1-Jul-2024
  • (2024)Exploring API behaviours through generated examplesSoftware Quality Journal10.1007/s11219-024-09668-232:2(729-763)Online publication date: 22-Apr-2024
  • (2023)How Domain Experts Use an Embedded DSLProceedings of the ACM on Programming Languages10.1145/36228517:OOPSLA2(1499-1530)Online publication date: 16-Oct-2023
  • Show More Cited By

Index Terms

  1. Interactive Extraction of Examples from Existing Code

    Recommendations

    Comments

    Please enable JavaScript to view thecomments powered by Disqus.

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    CHI '18: Proceedings of the 2018 CHI Conference on Human Factors in Computing Systems
    April 2018
    8489 pages
    ISBN:9781450356206
    DOI:10.1145/3173574
    Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for third-party components of this work must be honored. For all other uses, contact the Owner/Author.

    Sponsors

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 19 April 2018

    Check for updates

    Badges

    • Honorable Mention

    Author Tags

    1. example sharing
    2. programming support

    Qualifiers

    • Research-article

    Funding Sources

    Conference

    CHI '18
    Sponsor:

    Acceptance Rates

    CHI '18 Paper Acceptance Rate 666 of 2,590 submissions, 26%;
    Overall Acceptance Rate 6,199 of 26,314 submissions, 24%

    Upcoming Conference

    CHI 2025
    ACM CHI Conference on Human Factors in Computing Systems
    April 26 - May 1, 2025
    Yokohama , Japan

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)226
    • Downloads (Last 6 weeks)36
    Reflects downloads up to 30 Nov 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2024)Do LLMs Meet the Needs of Software Tutorial Writers? Opportunities and Design ImplicationsProceedings of the 2024 ACM Designing Interactive Systems Conference10.1145/3643834.3660692(1760-1773)Online publication date: 1-Jul-2024
    • (2024)Exploring API behaviours through generated examplesSoftware Quality Journal10.1007/s11219-024-09668-232:2(729-763)Online publication date: 22-Apr-2024
    • (2023)How Domain Experts Use an Embedded DSLProceedings of the ACM on Programming Languages10.1145/36228517:OOPSLA2(1499-1530)Online publication date: 16-Oct-2023
    • (2023)Listen Veronica! Can You Give Me a Hand With This Bug?Companion Proceedings of the 2023 ACM SIGCHI Symposium on Engineering Interactive Computing Systems10.1145/3596454.3597179(24-30)Online publication date: 27-Jun-2023
    • (2023)Colaroid: A Literate Programming Approach for Authoring Explorable Multi-Stage TutorialsProceedings of the 2023 CHI Conference on Human Factors in Computing Systems10.1145/3544548.3581525(1-22)Online publication date: 19-Apr-2023
    • (2022)Modular information flow through ownershipProceedings of the 43rd ACM SIGPLAN International Conference on Programming Language Design and Implementation10.1145/3519939.3523445(1-14)Online publication date: 9-Jun-2022
    • (2022)Crystalline: Lowering the Cost for Developers to Collect and Organize Information for Decision MakingProceedings of the 2022 CHI Conference on Human Factors in Computing Systems10.1145/3491102.3501968(1-16)Online publication date: 29-Apr-2022
    • (2022)Dear Diary: On Documenting Novices’ Development Process2022 IEEE Symposium on Visual Languages and Human-Centric Computing (VL/HCC)10.1109/VL/HCC53370.2022.9833003(1-3)Online publication date: 12-Sep-2022
    • (2022)Exploring D3 Implementation Challenges on Stack Overflow2022 IEEE Visualization and Visual Analytics (VIS)10.1109/VIS54862.2022.00009(1-5)Online publication date: Oct-2022
    • (2021)Visualizing Examples of Deep Neural Networks at ScaleProceedings of the 2021 CHI Conference on Human Factors in Computing Systems10.1145/3411764.3445654(1-14)Online publication date: 6-May-2021
    • Show More Cited By

    View Options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Login options

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media