skip to main content
10.1145/2380116.2380145acmconferencesArticle/Chapter ViewAbstractPublication PagesuistConference Proceedingsconference-collections
research-article

SnipMatch: using source code context to enhance snippet retrieval and parameterization

Published: 07 October 2012 Publication History

Abstract

Programmers routinely use source code snippets to increase their productivity. However, locating and adapting code snippets to the current context still takes time: for example, variables must be renamed, and dependencies included. We believe that when programmers decide to invest time in creating a new code snippet from scratch, they would also be willing to spend additional effort to make that code snippet configurable and easy to integrate. To explore this insight, we built SnipMatch, a plug-in for the Eclipse IDE. SnipMatch introduces a simple markup that allows snippet authors to specify search patterns and integration instructions. SnipMatch leverages this information, in conjunction with current code context, to improve snippet search and parameterization. For example, when a search query includes local variables, SnipMatch suggests compatible snippets, and automatically adapts them by substituting in these variables. In the lab, we observed that participants integrated snippets faster when using SnipMatch than when using standard Eclipse. Findings from a public deployment to 93 programmers suggest that SnipMatch has become integrated into the work practices of real users.

Supplementary Material

JPG File (paper_0322-file3.jpg)
suppl.mov (paper_0322-file3.m4v)
Supplemental video

References

[1]
Adar, E., Dontcheva, M., Fogarty, J., and Weld, D. S. Zoetrope: Interacting with the Ephemeral Web. In Proc. UIST. pp. 239--48, 2008.
[2]
Bajracharya, S., T. Ngo, et al. Sourcerer: A Search Engine for Open Source Code Supporting Structure-Based Search. In Companion to OOPSLA: ACM SIGPLAN. pp. 681--82, 2006.
[3]
Brandt, J., Dontcheva, M., Weskamp, M., Klemmer, S. R. Example-centric programming: integrating web search into the development environment. In Proc. CHI. pp. 513--522, 2010.
[4]
Brandt, J., Guo, P. J., Lewenstein, J., Dontcheva, M., Klemmer, S. R. 2009. Opportunistic Programming: Writing Code to Prototype, Ideate, and Discover. IEEE Software, 26 (5), 18--24.
[5]
Brandt, J., Guo, P. J., Lewenstein, J., Dontcheva, M., Klemmer, S. R. Two Studies of Opportunistic Programming: Interleaving Web Foraging, Learning, and Writing Code. In Proc. CHI. pp. 1589--1598, 2009.
[6]
Dontcheva, M., Drucker, S. M., Salesin, D., and Cohen, M. F. Relations, cards, and search templates: user-guided web data integration and layout. In Proc. UIST. pp. 61--70, 2007.
[7]
Dörner, C., Myers, B. A. EUKLAS, Plug-in for Eclipse IDE. http://www.cs.cmu.edu/~euklas.
[8]
Eclipse Quick Fix. http://wiki.eclipse.org/FAQ_What_is_a_Quick_Fix%3F
[9]
Eclipse Templates. http://www.ibm.com/developerworks/opensource/tutorials/os-eclipse-code-templates/index.html
[10]
Furnas, G. W., Landauer, T. K., Gomez, L. M., and Dumais, S. T. The vocabulary problem in human-system communication. CACM 30, 11 (Nov 1987), 964--971.
[11]
Google Code Search. http://www.google.com/codesearch
[12]
Gray, W. D. and D. A. Boehm-Davis. Milliseconds Matter: An Introduction to Microstrategies and to Their Use in Describing and Predicting Interactive Behavior. Journal of Experimental Psychology: Applied 6(4). pp. 322--35, 2000.
[13]
Hartmann, B., MacDougall, D., Brandt, J., and Klemmer, S. What Would Other Programmers Do? Suggesting Solutions to Error Mes-sages. In Proc. CHI. pp. 1019--1028, 2010.
[14]
Hearst, M. Search User Interfaces, Cambridge University Press, Cambridge, UK, 2009.
[15]
Hoffmann, R., Fogarty, J., and Weld, D. S. Assieme: Finding and Leveraging Implicit References in a Web Search Interface for Pro-grammers. In Proc. UIST. pp. 13--22, 2007.
[16]
Holmes, R., Murphy, G. C. Using structural context to recommend source code examples. In Proc. ICSE. pp. 117--125, 2005.
[17]
Jones, K. S. A Statistical Interpretation of Term Specificity and Its Application in Retrieval. Journal of Documentation 28: 11, 1972.
[18]
Little, G. and Miller, R. C. Keyword Programming in Java. In Proc. ASE. pp. 84--93, 2007.
[19]
Little, G. and Miller, R. C. Translating keyword commands into executable code. In Proc. UIST. pp. 135--144, 2006.
[20]
Little, G., Lau, T.A., Cypher, A., Lin, J., Haber, E. M., Kandogan, E. Koala: capture, share, automate, personalize business processes on the web. In Proc. CHI. pp. 943--946, 2007.
[21]
M. Kim, L. Bergman, T. Lau, and D. Notkin. An ethnographic study of copy and paste programming practices in OOPL. In Proc. ESEM. pp. 83--92, 2004.
[22]
Mamykina, L., Manoim, B., Mittal, M., Hripcsak, G., Hartmann, B. 2011. Design lessons from the fastest q&a site in the west. In Proc. CHI. pp. 2857--2866, 2011.
[23]
Mandelin, D., Xu, L., Bodík, R., and Kimelman, D. Jungloid Mining: Helping to Navigate the API Jungle. In Proc. PLDI. pp. 48--61, 2005.
[24]
Medynskiy, Y., Dontcheva M., and Drucker, S. M. Exploring Web-sites through Contextual Facets. In Proc. CHI. pp. 2013--22, 2009.
[25]
Miller, R. C., Chou, V. H., Bernstein, M., Little, G., Van Kleek, M., Karger, D., and Schraefel, M. Inky: a sloppy command line for the web with rich visual feedback. In Proc. UIST. pp. 131--140, 2008.
[26]
Morville, P., and Callender, J. Search Patterns: Design for Discovery. O'Reilly Media, Inc., 2010.
[27]
Oney, S., Brandt, J. Codelets: Linking Interactive Documentation and Example Code in the Editor. To appear in Proc. CHI. 2012.
[28]
Reiss, S. P. Semantics-based code search. ICSE 2009.
[29]
Sahavechaphan, N. and Claypool, K. XSnippet: Mining for Sample Code. In Proc. of OOPSLA. pp. 413--30, 2006.
[30]
Stylos, J. and Myers, B. A. Mica: A Web-Search Tool for Finding API Components and Examples. In Proc. VL/HCC. pp. 195--202, 2006.
[31]
Teevan, J., Cutrell, E., et al. Visual Snippets: Summarizing Web Pages for Search and Revisitation. In Proc. CHI. pp. 2023--32, 2009.
[32]
Thummalapenta, S. and Xie, T. PARSEweb: A Programmer Assistant for Reusing Open Source Code on the Web. In Proc. ASE. pp. 204--13, 2007.
[33]
Xie, T., Pei, J. MAPO: Mining API usages from open source repositories. In Proc. MSR. pp. 54--57, 2006.
[34]
Yeh, R. B., Paepcke, A., and Klemmer, S.R. Iterative Design and Evaluation of an Event Architecture for Pen-and-Paper Interfaces. In Proc. UIST. pp. 111--120, 2008.

Cited By

View all
  • (2024)How Do Developers Adapt Code Snippets to Their Contexts? An Empirical Study of Context-Based Code Snippet AdaptationsIEEE Transactions on Software Engineering10.1109/TSE.2024.339551950:11(2712-2731)Online publication date: Nov-2024
  • (2023)Big Code Search: A BibliographyACM Computing Surveys10.1145/360490556:1(1-49)Online publication date: 26-Aug-2023
  • (2023)Code Search: A Survey of Techniques for Finding CodeACM Computing Surveys10.1145/356597155:11(1-31)Online publication date: 9-Feb-2023
  • Show More Cited By

Index Terms

  1. SnipMatch: using source code context to enhance snippet retrieval and parameterization

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    UIST '12: Proceedings of the 25th annual ACM symposium on User interface software and technology
    October 2012
    608 pages
    ISBN:9781450315807
    DOI:10.1145/2380116
    Permission to make digital or hard copies of all or part 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 components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

    Sponsors

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 07 October 2012

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. example-centric development
    2. natural language processing
    3. prototyping

    Qualifiers

    • Research-article

    Conference

    UIST '12

    Acceptance Rates

    Overall Acceptance Rate 561 of 2,567 submissions, 22%

    Upcoming Conference

    UIST '25
    The 38th Annual ACM Symposium on User Interface Software and Technology
    September 28 - October 1, 2025
    Busan , Republic of Korea

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)8
    • Downloads (Last 6 weeks)0
    Reflects downloads up to 25 Feb 2025

    Other Metrics

    Citations

    Cited By

    View all
    • (2024)How Do Developers Adapt Code Snippets to Their Contexts? An Empirical Study of Context-Based Code Snippet AdaptationsIEEE Transactions on Software Engineering10.1109/TSE.2024.339551950:11(2712-2731)Online publication date: Nov-2024
    • (2023)Big Code Search: A BibliographyACM Computing Surveys10.1145/360490556:1(1-49)Online publication date: 26-Aug-2023
    • (2023)Code Search: A Survey of Techniques for Finding CodeACM Computing Surveys10.1145/356597155:11(1-31)Online publication date: 9-Feb-2023
    • (2021)”It’s Just Everything Outside of the IDE that’s the Problem”:Proceedings of the 2021 CHI Conference on Human Factors in Computing Systems10.1145/3411764.3445090(1-12)Online publication date: 6-May-2021
    • (2020)Extracting Semantics from Question-Answering Services for Snippet ReuseFundamental Approaches to Software Engineering10.1007/978-3-030-45234-6_6(119-139)Online publication date: 17-Apr-2020
    • (2020)Mining Source Code for Snippet ReuseMining Software Engineering Data for Software Reuse10.1007/978-3-030-30106-4_7(175-192)Online publication date: 31-Mar-2020
    • (2020)Mining Source Code for Component ReuseMining Software Engineering Data for Software Reuse10.1007/978-3-030-30106-4_6(133-174)Online publication date: 31-Mar-2020
    • (2020)Theoretical Background and State-of-the-ArtMining Software Engineering Data for Software Reuse10.1007/978-3-030-30106-4_2(13-43)Online publication date: 31-Mar-2020
    • (2019)Unakite: Scaffolding Developers' Decision-Making Using the WebProceedings of the 32nd Annual ACM Symposium on User Interface Software and Technology10.1145/3332165.3347908(67-80)Online publication date: 17-Oct-2019
    • (2019)Towards a Model of API Learning2019 IEEE Symposium on Visual Languages and Human-Centric Computing (VL/HCC)10.1109/VLHCC.2019.8818850(163-168)Online publication date: Oct-2019
    • Show More Cited By

    View Options

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Figures

    Tables

    Media

    Share

    Share

    Share this Publication link

    Share on social media