Automated Refactoring for Delphi

Refactoring is 'improving the design of code after it has been written'[1].
Castalia offers automated refactoring for Delphi
for several commonly used changes to Delphi code.

Refactoring is 'improving the design of code after it has been written' (Fowler, Martin. Refactoring pp xvi). Developers spend a lot of time maintaining code that has already been written, and often has already been tested. Castalia offers automated refactoring for Delphi - based on published and accepted methodologies - for several commonly used changes to Delphi code.

Castalia's refactoring works on the scope of the entire Delphi project. When a refactoring is invoked, Castalia will run through your entire project, evaluating the relevance of the refactoring to each unit, and applying changes as necessary.

Screenshot of automated refactoring in Delphi with Castalia

Rename Local Variable

This refactoring changes the name of a local variable and all references to the variable within a single method.

Rename Parameter

This refactoring hanges the name of a parameter in both the interface and implementation declarations of a Delphi unit, and all references to the parameter within the procedure or function.

Inline Temporary Variable

When a variable is assigned the value of a simple statement, this refactoring removes the variable from the procedure and replaces all instances of the variable with the simple statement.

Introduce Explaining Variable

This refactoring declares a new variable and initializes it to a specified Delphi expression.

Split Temporary Variable

When a variable is assigned more than once, it is often wise to "split" the variable into two distinct variables. The Split Temporary Variable refactoring automates this by adding a new variable to the procedure and making appropriate changes to split the original variable in two.

Remove Unused Variables

This refactoring analyzes the method and removes declarations of all local variables that are unused.

Eliminate 'with'

This refactoring removes a Delphi 'with' clause from the code and dereferences all declarations.

Rename Method

This refactoring changes the name of a procedure or function and all references to the procedure or function throughout the Delphi project.

Extract Method

This refactoring extracts a code segment into a separate procedure, replacing the original segment with an appropriately constructed call to the new procedure.

Add Parameter

This refactoring adds a new parameter to a procedure or function, synchronizing the declarations of the method in both the interface and implementation sections of the Delphi unit.

Rename Class

This refactoring changes the name of a class, changing all references to the name of the class throughout the entire Delphi project to reflect the class' new name.

Move Class

This refactoring moves a class definition and all of its methods into a different unit within the Delphi project.

1. Fowler, Martin. Refactoring pp xvi
Built with Delphi Embarcadero Technology Partner