This Article 
   
 Share 
   
 Bibliographic References 
   
 Add to: 
 
Digg
Furl
Spurl
Blink
Simpy
Google
Del.icio.us
Y!MyWeb
 
 Search 
   
Refactoring on the Cheap
January/February 2012 (vol. 29 no. 1)
pp. 96, 94-95
Diomidis Spinellis, Athens University of Economics
Refactoring with ad hoc methods increases the scope of possible refactorings, allows you to use the same approaches on various languages, and opens your mind to more refactoring possibilities. The basic tool for performing a refactoring within a file is the editor's substitution command used in conjunction with regular expressions. To apply substitution commands to all files in a directory or throughout your project use the stream editor sed. The Perl and Ruby scripting languages also offer in-place substitution functionality through command-line invocation options, and their expression evaluators allow you to perform more sophisticated processing. Finally, you can easily change file names or move files around by using find to locate the corresponding files and sed to craft the text of a command that will accomplish the action you want. You can increase your effectiveness in this approach by building expressions incrementally, by tolerating silence and noise, and by writing consistent code.
Index Terms:
refactoring, regular expressions, IDE, Unix
Citation:
Diomidis Spinellis, "Refactoring on the Cheap," IEEE Software, vol. 29, no. 1, pp. 96, 94-95, Jan.-Feb. 2012, doi:10.1109/MS.2012.14
Usage of this product signifies your acceptance of the Terms of Use.