Refactoring Code
Go Up to Refactoring Procedures Index
Refactoring refers to the capability to make structural changes to your code without changing the functionality of the code. Code can often be made more compact, more readable, and more efficient through selective refactoring operations. RAD Studio provides a set of refactoring operations that can help you re-architect your code in the most effective and efficient manner possible.
Refactoring operations are available for Delphi and C++.
You can access all refactoring commands from the Refactor menu or from the context menu in the Code Editor.
The Undo capability is available for all refactoring operations. Some operations can be undone using the standard Undo (CTRL+Z
) menu command, while the rename refactorings provide a specific Undo feature.
Refactoring Operations Supported only in Code Editor
When editing your Delphi or C++ code in the Code Editor, you can employ:
- Refactor > Rename
- Refactor > Declare Variable
- Refactor > Declare Field
- Refactor > Extract Method
- Refactor > Extract Resource String
- Refactor > Change Params.
- Refactor > Find Unit
- Search > Find References
- Using Sync Edit mode
- Renaming identifiers using Refactor > Rename (Delphi).
- Declaring new variables using Refactor > Declare Variable (Delphi).
- Declaring new fields using Refactor > Declare Field (Delphi).
- Creating a method from a code fragment using Refactor > Extract Method (Delphi).
- Converting a quoted string to a resource string using Refactor > Extract Resource String (Delphi).
- Changing parameters of procedures and functions using Refactor > Change Params.
- Finding and adding units using Refactor > Find Unit (Delphi).
- Finding References using Search > Find References (Delphi).
- Using Sync Edit mode.
Refactoring Operations Supported in both Code Editor and Modeling Views
In Code Editor and in Diagram View and Model View (used in UML Modeling), you can employ:
- Moving Members using Refactor > Move.
- Extracting Interfaces using Refactor > Extract Interface.
- Extracting Superclass using Refactor > Extract Superclass.
- "Pull Members Up" and "Push Members Down" using Refactor > Pull Members Up and Refactor > Push Members Down.
- "Safe Delete" using Refactor > Safe Delete.
- Creating Inline Variables using Refactor > Inline Variable.
- Introducing Fields using Refactor > Introduce Field.
- Introducing Variables using Refactor > Introduce Variable.
- Opening Refactorings Pane using View > Refactorings.