Search-Based Generalization and Refinement of Code Templates

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.

[1]  Claire Le Goues,et al.  GenProg: A Generic Method for Automatic Software Repair , 2012, IEEE Transactions on Software Engineering.

[2]  Ralph Johnson,et al.  design patterns elements of reusable object oriented software , 2019 .

[3]  Damien Doligez,et al.  A foundation for flow-based program matching: using temporal logic and model checking , 2009, POPL '09.

[4]  Bradley Alexander,et al.  Evolving patches for software repair , 2011, GECCO '11.

[5]  Yuanyuan Zhang,et al.  Search-based software engineering: Trends, techniques and applications , 2012, CSUR.

[6]  Benjamin Livshits,et al.  Finding application errors and security flaws using PQL: a program query language , 2005, OOPSLA '05.

[7]  Miryung Kim,et al.  Lase: Locating and applying systematic edits by learning from examples , 2013, 2013 35th International Conference on Software Engineering (ICSE).

[8]  James R. Cordy,et al.  The TXL source transformation language , 2006, Sci. Comput. Program..

[9]  Elnar Hajiyev,et al.  codeQuest: Scalable Source Code Queries with Datalog , 2006, ECOOP.

[10]  Eelco Visser,et al.  Program Transformation with Stratego/XT: Rules, Strategies, Tools, and Systems in Stratego/XT 0.9 , 2003, Domain-Specific Program Generation.

[11]  Name M. Lastname Automatically Finding Patches Using Genetic Programming , 2013 .

[12]  Andy Kellens,et al.  The SOUL tool suite for querying programs in symbiosis with Eclipse , 2011, PPPJ.

[13]  Kris De Volder,et al.  Navigating and querying code without getting lost , 2003, AOSD '03.

[14]  Günter Kniesel,et al.  A comparison of logic-based infrastructures for concern detection and extraction , 2007, LATE@AOSD.

[15]  Lionel C. Briand,et al.  A practical guide for using statistical tests to assess randomized algorithms in software engineering , 2011, 2011 33rd International Conference on Software Engineering (ICSE).

[16]  Yann-Gaël Guéhéneuc,et al.  P-MARt : Pattern-like Micro Architecture Repository , 2007 .

[17]  Katsuro Inoue,et al.  The Ekeko/X Program Transformation Tool , 2014, 2014 IEEE 14th International Working Conference on Source Code Analysis and Manipulation.