Refactoring on the Cheap

Diomidis Spinellis*

*Corresponding author for this work

Research output: Contribution to journalArticleScientific

1 Citation (Scopus)


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.

Original languageEnglish
Pages (from-to)96-98
Number of pages3
JournalIEEE Software
Issue number1
Publication statusPublished - 2012
Externally publishedYes


Dive into the research topics of 'Refactoring on the Cheap'. Together they form a unique fingerprint.

Cite this