Go Up to Refactoring Applications Index
Refactoring is a technique you can use to restructure and modify your existing code in such a way that the intended behavior of your code stays the same. Refactoring allows you to streamline, simplify, and improve both performance and readability of your application code.
Each refactoring operation acts upon one specific type of identifiers. By performing a number of successive refactorings, you build up a large transformation of the code structure, and yet, because each refactoring is limited to a single type of object or operation, the margin of error is small. You can always back out of a particular refactoring, if you find that it gives you an unexpected result. Each refactoring operation has its own set of constraints. For example, you cannot rename symbols that are imported by the compiler. These are described in each of the specific refactoring topics. In Delphi refactoring operations can be applied to identifiers used with generics.
RAD Studio includes a refactoring engine that evaluates and executes the refactoring operation. The engine also displays a preview of what changes will occur in the Refactorings pane that appears at the bottom of the Code Editor. The potential refactoring operations are displayed as tree nodes, which can be expanded to show additional items that might be affected by the refactoring operation, if they exist. Warnings and errors also appear in this pane. You can access the refactoring tools from the Refactor, Search > Find References, and View > Refactorings menus and from the context menus (right-click to activate the menu) of the Code Editor and of the Modeling's Diagram View or Model View.
The primary resource book on refactoring is Refactoring - Improving the Design of Existing Code by Martin Fowler (Addison - Wesley, 1999).
The following refactoring operations are accessible only from the Code Editor:
- Symbol renaming (Delphi)
- Extracting methods (Delphi)
- Changing parameters of procedures and functions (Delphi)
- Extracting resource strings (Delphi)
- Declaring variables and fields (Delphi)
- Finding units (Delphi)
- Undo renaming operations (Delphi)
- Finding references (Delphi
- Sync Edit mode
In the Code Editor or in Diagram View and Model View for Modeling, you can use the following refactoring operations:
- Moving members
- Extracting interfaces
- Extracting superclass
- Pull members up and Push members down
- Safe Delete
- Creating inline variables
- Introducing fields
- Introducing variables
- Previewing refactoring operations in Refactorings pane