Refactoring Code

Refactoring refers to the reshuffling of code to improve its style, design, etc. The outcome of running the code generally doesn't change as far as the user is concerned, but the guts under the hood do. I'm not going to deal with refactoring so much as particular refactoring tools in Eclipse.

Renaming something can be a beast of a task when you have a large program. You suddenly decide you need to change the name of a class or one of its methods, but you've already written code that invokes it. What do you do? Granted it's not that hard to take care of this using regular expression find/replace or writing a script, but do you really want to bother with that each time you need to rename something?

Refactor context menus in Package Explorer and Edit Pane

Eclipse makes this absurdly easy to do. Right-click on almost anything and choose Refactor > Rename. Type in a new name for whatever it is, and make sure that the Update References checkbox is checked. This will ensure that all references in all of your code will be updated. That means method calls, imports, data types, and so on. Go ahead and click Ok, or click Preview if you want to make sure you aren't screwing anything up. Sometimes preview is forced anyway. This will work for classes and interfaces in the Package Explorer, or any variable, method, or class name declared in the edit pane.

The Refactor and Source menus also have a ton of extra stuff you can use to do take care of busywork. Explore them at your leisure.