Did you know that Sting used to be named Gordon Sumner, that John Denver was Henry John Deutschendorf or that Michael J. Fox was Michael A. Fox? Name changes are uncommon when we’re talking about people (except in the entertainment industry, apparently) but they’re very common when we’re talking about code.
Renaming is one of the most common refactorings I use, probably because naming things is hard but also possibly because I am fickle. In any case Eclipse provides a handy refactoring shortcut for renaming things. Try highlighting a symbol in an editor, say a class name, and hit Alt-Shift-R. You’ll be prompted to type a new name and then hit Enter at which point Eclipse will show you a preview of all the changes it’s going to make – any of which you can accept or reject. The same shortcut can be used on files and packages in the Package Exporer view.
Today’s tip:
Alt-Shift-R: rename refactoring