Title :
Source code modification technology based on parameterized code patterns
Author :
Itsykson, Vladimir ; Timofeyev, Denis
Author_Institution :
St.-Petersburg State Polytech. Univ., St. Petersburg, Russia
Abstract :
Source code modification is one of the most frequent operations which developers perform in software life cycle. Such operation can be performed in order to add new functionality, fix bugs or bad code style, optimize performance, increase readability, etc. During the modification of existing source code developer needs to find parts of code, which meet to some conditions, and change it according to some rules. Usually developers perform such operations repeatedly by hand using primitive search/replace mechanisms and "copy and paste programming", and that is why manual modification of large-scale software systems is a very error-prone and time-consuming process. Automating source code modifications is one of the possible ways of coping with this problem because it can considerably decrease both the amount of errors and the time needed in the modification process. Automated source code modification technique based on parameterized source code patterns is considered in this article. Intuitive modification description that does not require any knowledge of complex transformation description languages is the main advantage of our technique. We achieve this feature by using a special source code pattern description language which is closely tied with the programming language we\´re modifying. This allows developers to express the modification at hand as simple "before "/"after" source code patterns very similar to source code. Regexp-like elements are added to the language to increase its expressionalpower. The source code modification is carried out using difference abstract syntax trees. We build a set of transformation operations based on "before"/"after" patterns (using algorithm for change detection in hierarchically structured information) and apply them to those parts of source code that match with the search "before " pattern. After abstract syntax tree transformation is completed we pretty-print them back to source code. A prototype of source code modification sy- - stem based on this technique has been implemented for the Java programming language. Experimental results show that this technique in some cases can increase the speed of source code modifications by several orders of magnitude, at the same time completely avoiding "copy-and paste " errors. In future we are planning to integrate prototype with existing development environments such as Eclipse and NetBeans.
Keywords :
Java; computational linguistics; object-oriented programming; program compilers; Eclipse; Java programming language; NetBeans; Regexp like element; abstract syntax tree; automated source code modification technique; complex transformation description language; copy and paste programming; error prone process; large scale software system; parameterized source code pattern; software life cycle; source code developer; source code pattern description language; Computer bugs; Electronic mail; Java; Programming; Prototypes; Syntactics; abstract syntax tree modification; differential abstract syntax tree; parameterized source code patterns; source code modification; source code patterns search;
Conference_Titel :
Software Engineering Conference (CEE-SECR), 2010 6th Central and Eastern European
Conference_Location :
Moscow
Print_ISBN :
978-1-4577-0605-9
DOI :
10.1109/CEE-SECR.2010.5783177