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.
Supplemental Material
- Adar, E., Dontcheva, M., Fogarty, J., and Weld, D. S. Zoetrope: Interacting with the Ephemeral Web. In Proc. UIST. pp. 239--48, 2008. Google ScholarDigital Library
- 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. Google ScholarDigital Library
- 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. Google ScholarDigital Library
- 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. Google ScholarDigital Library
- 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. Google ScholarDigital Library
- 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. Google ScholarDigital Library
- Dörner, C., Myers, B. A. EUKLAS, Plug-in for Eclipse IDE. http://www.cs.cmu.edu/~euklas.Google Scholar
- Eclipse Quick Fix. http://wiki.eclipse.org/FAQ_What_is_a_Quick_Fix%3FGoogle Scholar
- Eclipse Templates. http://www.ibm.com/developerworks/opensource/tutorials/os-eclipse-code-templates/index.htmlGoogle Scholar
- 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. Google ScholarDigital Library
- Google Code Search. http://www.google.com/codesearchGoogle Scholar
- 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.Google ScholarCross Ref
- 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. Google ScholarDigital Library
- Hearst, M. Search User Interfaces, Cambridge University Press, Cambridge, UK, 2009. Google ScholarDigital Library
- 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. Google ScholarDigital Library
- Holmes, R., Murphy, G. C. Using structural context to recommend source code examples. In Proc. ICSE. pp. 117--125, 2005. Google ScholarDigital Library
- Jones, K. S. A Statistical Interpretation of Term Specificity and Its Application in Retrieval. Journal of Documentation 28: 11, 1972.Google ScholarCross Ref
- Little, G. and Miller, R. C. Keyword Programming in Java. In Proc. ASE. pp. 84--93, 2007. Google ScholarDigital Library
- Little, G. and Miller, R. C. Translating keyword commands into executable code. In Proc. UIST. pp. 135--144, 2006. Google ScholarDigital Library
- 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. Google ScholarDigital Library
- 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. Google ScholarDigital Library
- 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. Google ScholarDigital Library
- 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. Google ScholarDigital Library
- Medynskiy, Y., Dontcheva M., and Drucker, S. M. Exploring Web-sites through Contextual Facets. In Proc. CHI. pp. 2013--22, 2009. Google ScholarDigital Library
- 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. Google ScholarDigital Library
- Morville, P., and Callender, J. Search Patterns: Design for Discovery. O'Reilly Media, Inc., 2010. Google ScholarDigital Library
- Oney, S., Brandt, J. Codelets: Linking Interactive Documentation and Example Code in the Editor. To appear in Proc. CHI. 2012. Google ScholarDigital Library
- Reiss, S. P. Semantics-based code search. ICSE 2009. Google ScholarDigital Library
- Sahavechaphan, N. and Claypool, K. XSnippet: Mining for Sample Code. In Proc. of OOPSLA. pp. 413--30, 2006. Google ScholarDigital Library
- 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. Google ScholarDigital Library
- Teevan, J., Cutrell, E., et al. Visual Snippets: Summarizing Web Pages for Search and Revisitation. In Proc. CHI. pp. 2023--32, 2009. Google ScholarDigital Library
- Thummalapenta, S. and Xie, T. PARSEweb: A Programmer Assistant for Reusing Open Source Code on the Web. In Proc. ASE. pp. 204--13, 2007. Google ScholarDigital Library
- Xie, T., Pei, J. MAPO: Mining API usages from open source repositories. In Proc. MSR. pp. 54--57, 2006. Google ScholarDigital Library
- 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. Google ScholarDigital Library
Index Terms
- SnipMatch: using source code context to enhance snippet retrieval and parameterization
Recommendations
Example-centric programming: integrating web search into the development environment
CHI '10: Proceedings of the SIGCHI Conference on Human Factors in Computing SystemsThe ready availability of online source-code examples has fundamentally changed programming practices. However, current search tools are not designed to assist with programming tasks and are wholly separate from editing tools. This paper proposes that ...
Fishtail: from task context to source code examples
TOPI '11: Proceedings of the 1st Workshop on Developing Tools as Plug-insImplementing software development tools as integrated development environment (IDE) plugins gives tools direct access to a range of useful representations of the program being created and can improve programmer efficiency. These benefits must be weighed ...
Portfolio: Searching for relevant functions and their usages in millions of lines of code
Testing, debugging, and error handling, formal methods, lifecycle concerns, evolution and maintenanceDifferent studies show that programmers are more interested in finding definitions of functions and their uses than variables, statements, or ordinary code fragments. Therefore, developers require support in finding relevant functions and determining ...
Comments