Skip to main content

Search-Based Generalization and Refinement of Code Templates

  • Conference paper
  • First Online:
Book cover Search Based Software Engineering (SSBSE 2016)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 9962))

Included in the following conference series:

Abstract

Several tools support code templates as a means to specify searches within a program’s source code. Despite their ubiquity, code templates can often prove difficult to specify, and may produce too many or too few match results. In this paper, we present a search-based approach to support developers in specifying templates. This approach uses a suite of mutation operators to recommend changes to a given template, such that it matches with a desired set of code snippets. We evaluate our approach on the problem of inferring a code template that matches all instances of a design pattern, given one instance as a starting template.

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 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight 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.

    The Ekeko/X program transformation tool and the extensions presented in this paper are available at: https://github.com/cderoove/damp.ekeko.snippets.

  2. 2.

    Experiment data and instructions to reproduce the experiment are available at the Ekeko/X website: https://github.com/cderoove/damp.ekeko.snippets.

  3. 3.

    If a method is removed, match|set is always added so the template still matches.

  4. 4.

    The system used in the experiment has 16GB RAM and an Intel Core i7 (Haswell).

References

  1. Ackling, T., Alexander, B., Grunert, I.: Evolving patches for software repair. In: Proceedings of the 13th Annual Conference on Genetic and Evolutionary Computation, GECCO 2011, pp. 1427–1434. ACM (2011)

    Google Scholar 

  2. Arcuri, A., Briand, L.: A practical guide for using statistical tests to assess randomized algorithms in software engineering. In: 33rd International Conference on Software Engineering (ICSE), pp. 1–10 (2011)

    Google Scholar 

  3. Brunel, J., Doligez, D., Hansen, R.R., Lawall, J.L., Muller, G.: A foundation for flow-based program matching: Using temporal logic and model checking. In Proceedings of the 36th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2009, pp. 114–126 (2009)

    Google Scholar 

  4. Cordy, J.R.: The TXL source transformation language. Sci. Comput. Program. 61(3), 190–210 (2006)

    Article  MathSciNet  MATH  Google Scholar 

  5. De Roover, C., Inoue, K.: The Ekeko/X program transformation tool. In: 2014 IEEE 14th International Working Conference on Source Code Analysis and Manipulation (SCAM), pp. 53–58, September 2014

    Google Scholar 

  6. De Roover, C., Noguera, C., Kellens, A., Jonckers, V.: The soul tool suite for querying programs in symbiosis with eclipse. In: Proceedings of the 9th International Conference on Principles and Practice of Programming in Java, pp. 71–80. ACM (2011)

    Google Scholar 

  7. Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-oriented Software, vol. 49(120), p. 11. Addison-Wesley, Reading (1995)

    Google Scholar 

  8. Guéhéneuc, Y.-G.: P-mart: pattern-like micro architecture repository. In: Proceedings of the 1st EuroPLoP Focus Group on Pattern Repositories (2007)

    Google Scholar 

  9. Hajiyev, E., Verbaere, M., de Moor, O.: codeQuest: scalable source code queries with datalog. In: Thomas, D. (ed.) ECOOP 2006. LNCS, vol. 4067, pp. 2–27. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  10. Harman, M., Mansouri, S.A., Zhang, Y.: Search-based software engineering: trends, techniques and applications. ACM Comput. Surv. 45(1), 11:1–11:61 (2012)

    Article  Google Scholar 

  11. Janzen, D., De Volder, K.: Navigating and querying code without getting lost. In: Proceedings of the 2nd International Conference on Aspect-Oriented Software Development, pp. 178–187. ACM (2003)

    Google Scholar 

  12. Kniesel, G., Hannemann, J., Rho, T.: A comparison of logic-based infrastructures for concern detection and extraction. In: Proceedings of the 3rd Workshop on Linking Aspect Technology And Evolution (LATE 2007). ACM (2007)

    Google Scholar 

  13. Le Goues, C., Nguyen, T., Forrest, S., Weimer, W.: Genprog: a generic method for automatic software repair. IEEE Trans. Softw. Eng. 38(1), 54–72 (2012)

    Article  Google Scholar 

  14. Luke, S.: Essentials of Metaheuristics. Lulu, 2nd edn. (2013). http://cs.gmu.edu/~sean/book/metaheuristics/

  15. Martin, M., Livshits, B., Lam, M.S.: Finding application errors, security flaws using PQL: a program query language. In: Proceedings of the 20th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2005, pp. 365–383 (2005)

    Google Scholar 

  16. Meng, N., Kim, M., McKinley, K.S.: LASE: locating and applying systematic edits by learning from examples. In: Proceedings of the International Conference on Software Engineering, pp. 502–511. IEEE Press (2013)

    Google Scholar 

  17. Visser, E.: Program transformation with Stratego/XT. In: Lengauer, C., Batory, D., Blum, A., Odersky, M. (eds.) Domain-Specific Program Generation. LNCS, vol. 3016, pp. 216–238. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  18. Weimer, W., Nguyen, T., Le Goues, C., Forrest, S.: Automatically finding patches using genetic programming. In: Proceedings of the 31st International Conference on Software Engineering, pp. 364–374. IEEE CS (2009)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding authors

Correspondence to Tim Molderez or Coen De Roover .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2016 Springer International Publishing AG

About this paper

Cite this paper

Molderez, T., De Roover, C. (2016). Search-Based Generalization and Refinement of Code Templates. In: Sarro, F., Deb, K. (eds) Search Based Software Engineering. SSBSE 2016. Lecture Notes in Computer Science(), vol 9962. Springer, Cham. https://doi.org/10.1007/978-3-319-47106-8_13

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-47106-8_13

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-47105-1

  • Online ISBN: 978-3-319-47106-8

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics