skip to main content
article

XSnippet: mining For sample code

Published:16 October 2006Publication History
Skip Abstract Section

Abstract

It is common practice for software developers to use examples to guide development efforts. This largely unwritten, yet standard, practice of "develop by example" is often supported by examples bundled with library or framework packages, provided in textbooks, and made available for download on both official and unofficial web sites. However, the vast number of examples that are embedded in the billions of lines of already developed library and framework code are largely untapped. We have developed XSnippet, a context-sensitive code assistant framework that allows developers to query a sample repository for code snippets that are relevant to the programming task at hand. In particular, our work makes three primary contributions. First, a range of queries is provided to allow developers to switch between a context-independent retrieval of code snippets to various degrees of context-sensitive retrieval for object instantiation queries. Second, a novel graph-based code mining algorithm is provided to support the range of queries and enable mining within and across method boundaries. Third, an innovative context-sensitive ranking heuristic is provided that has been experimentally proven to provide better ranking for best-fit code snippets than context-independent heuristics such as shortest path and frequency. Our experimental evaluation has shown that XSnippet has significant potential to assist developers, and provides better coverage of tasks and better rankings for best-fit snippets than other code assistant systems.

References

  1. V. R. Basili, L. C. Briand, and W. L. Melo. How reuse influences productivity in object-oriented systems. Communications of ACM, 39(10):104--116, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. J. D'Anjou, S. Fairbrother, D. Kehn, J. Kellerman, and P. McCarthy. The Java(TM) Developer's Guide to ECLIPSE (The 2nd Edition). Addison-Wesley Professional, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. O. Drori. Algorithm for Documents Ranking: Idea and Simulation Results. In Proceedings of the 14th international conference on Software Engineering and Knowledge Engineering, pages 99--102. ACM Press New York, NY, USA, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. P. Freeman. Software Reusability. IEEE Computer Society Press, 10662 Los Vaqueros Circle, Los Alamitos, CA 90720 USA, 1987.Google ScholarGoogle Scholar
  5. J. Goguen, D. Nguyen, J. Meseguer, Luqi, D. Zhang, and V. Berzins. Software Component Search. Journal of Systems Integration, 6(1/2):93--134, March 1996.Google ScholarGoogle ScholarCross RefCross Ref
  6. G. T. Heineman and W. T. Councill. Component-based Software Engineering. Addison-Wesley Publishing Company, Reading, Massachusetts, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. R. Hill and J. Rideout. Automatic method completion. In The 16th IEEE International Conference on Automated Software Engineering, pages 228--235, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. R. Holmes and G. C. Murphy. Using structural context to recommend source code examples. In Proceedings of the 27th International Conference on Software Engineering. ACM Press, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. J.-J. Jeng and B. H. C. Cheng. Specification Matching for Software Reuse: A Foundation*. In Proceedings of the 1995 Symposium on Software reusability, pages 97--105. ACM Press, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. G. T. Leavens and M. Sitaraman. Foundations of Component-Based Systems. Cambridge University Press, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. D. Mandelin, L. Xu, R. Bodk, and D. Kimelman. Jungloid mining: helping to navigate the api jungle. In Conference on Programming Language Design and Implementation (PLDI). ACM Press, June 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Y. Matsumoto. A Software Factory: An Overall Approach to Software Production. In P. Freeman, editor, Tutorial: Software Reusability. IEEE Computer Society Press, 1987.Google ScholarGoogle Scholar
  13. O. Nierstrasz and T. D. Meijler. Research Directions in Software Composition. ACM Computing Surveys, 27(2):262--264, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. R. Prieto-Diaz and P. Freeman. Classifying Software for Reusability. IEEE Software, 4(1):6--16, 1987.Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. N. Tansalarak and K. T. Claypool. Finding a Needle in the Haystack: A Technique for Ranking Matches between Components. In Proceedings of the 8th International SIGSOFT Symposium on Component-based Software Engineering (CBSE 2005): Software Components at Work, May 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. N. Tansalarak and K. T. Claypool. XSnippet: A Code Assistant Framework. Technical Report 2006-xxx, Department of Computer Science, University of Massachusetts - Lowell, March 2006. Available at http://www.cs.uml.edu/techrpts/reports.jsp.Google ScholarGoogle Scholar
  17. Y. Ye and G. Fischer. Supporting reuse by delivering taskrelevant and personalized information. In Proceedings of the 24th International Conference on Software Engineering, pages 513--523. ACM Press, May 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Y. Ye, G. Fischer, and B. Reeves. Integrating active information delivery and reuse repository systems. In International Symposium on Foundations of Software Engineering, pages 60--68. ACM Press, November 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. A. M. Zaremski and J. M. Wing. Signature Matching: a Tool for Using Software Libraries. In ACM Transactions on Software Engineering and Methodology (TOSEM), pages 146--170. ACM Press, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. A. M. Zaremski and J. M. Wing. Specification Matching of Software Components. In ACM Transactions on Software Engineering and Methodology (TOSEM), pages 333--369. ACM Press, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. XSnippet: mining For sample code

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 41, Issue 10
        Proceedings of the 2006 OOPSLA Conference
        October 2006
        480 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/1167515
        Issue’s Table of Contents
        • cover image ACM Conferences
          OOPSLA '06: Proceedings of the 21st annual ACM SIGPLAN conference on Object-oriented programming systems, languages, and applications
          October 2006
          514 pages
          ISBN:1595933484
          DOI:10.1145/1167473

        Copyright © 2006 ACM

        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]

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 16 October 2006

        Check for updates

        Qualifiers

        • article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader