Skip to main content

Mining Solutions for Extended Snippet Reuse

  • Chapter
  • First Online:
Mining Software Engineering Data for Software Reuse

Abstract

The introduction of question–answering services, such as Stack Overflow, has given rise to a new problem-solving paradigm in software development. Using these services, developers can post their programming questions online and get useful solutions by the community. In this chapter we propose a methodology that allows searching for solutions in Stack Overflow, using the main elements of a question post, including its title, tags, body, and source code snippets. We design a similarity scheme for these elements that can be used for finding similar question posts. Text elements are compared using Information Retrieval metrics, while snippet similarity is computed by first converting snippets into sequences using a representation that extracts structural information. The results of the evaluation of our methodology indicate that it can be effective for recommending similar question posts, and thus can be used to search for solutions without fully forming a question.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.00
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 109.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    Although our methodology is mostly language-agnostic, we have focused on Java Stack Overflow questions to demonstrate our proof of concept.

  2. 2.

    Our methodology supports all questions, regardless of the number of links. However, in the context of our evaluation, we may assume that questions with fewer links may be too localized and/or may not have similar question posts.

References

  1. Diamantopoulos T, Symeonidis A (2015) Employing source code information to improve question-answering in stack overflow. In: Proceedings of the 12th Working Conference on Mining Software Repositories, MSR ’15. IEEE Press, Piscataway, NJ, USA, pp 454–457

    Google Scholar 

  2. Ying ATT (2015) Mining challenge 2015: comparing and combining different information sources on the stack overflow data set. In: The 12th Working Conference on Mining Software Repositories, page to appear

    Google Scholar 

  3. Elasticsearch: RESTful, Distributed Search & Analytics. https://www.elastic.co/products/elasticsearch, 2016. [Retrieved: April 2016]

  4. Holmes R, Murphy GC (2005) Using structural context to recommend source code examples. In: Proceedings of the 27th International Conference on Software Engineering, ICSE ’05. ACM, New York, NY, USA, pp 117–125

    Google Scholar 

  5. Thummalapenta S, Xie T (2007) PARSEWeb: A Programmer Assistant for Reusing Open Source Code on the Web. In: Proceedings of the 22nd IEEE/ACM International Conference on Automated Software Engineering, ASE ’07. ACM, New York, NY, USA, pp 204–213

    Google Scholar 

  6. Sahavechaphan N, Claypool K (2006) XSnippet: mining for sample code. SIGPLAN Not 41(10):413–430

    Article  Google Scholar 

  7. Subramanian S, Holmes R (2013) Making sense of online code snippets. In: Proceedings of the 2013 10th IEEE Working Conference on Mining Software Repositories (MSR). pp 85–88

    Google Scholar 

  8. Subramanian S, Inozemtseva L, Holmes R (2014) Live API documentation. In: Proceedings of the 36th International Conference on Software Engineering, ICSE 2014. ACM, New York, NY, USA,pp 643–652

    Google Scholar 

  9. Ponzanelli L, Bavota G, Di Penta M, Oliveto R, Lanza M (2014) Mining stackoverflow to turn the IDE into a self-confident programming prompter. In: Proceedings of the 11th Working Conference on Mining Software Repositories, MSR 2014. ACM, New York, NY, USA, pp 102–111

    Google Scholar 

  10. Hsu SK, Lin SJ (2011) MACs: mining API code snippets for code reuse. Expert Syst Appl 38(6):7291–7301

    Article  Google Scholar 

  11. Cormen TH, Leiserson CE, Rivest RL, Stein C (2009) Introduction to algorithms, 3rd edn. The MIT Press, pp 390–396

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Themistoklis Diamantopoulos .

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Diamantopoulos, T., Symeonidis, A.L. (2020). Mining Solutions for Extended Snippet Reuse. In: Mining Software Engineering Data for Software Reuse. Advanced Information and Knowledge Processing. Springer, Cham. https://doi.org/10.1007/978-3-030-30106-4_8

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-30106-4_8

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-30105-7

  • Online ISBN: 978-3-030-30106-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics