Refactoring in Modeling

From RAD Studio
Jump to: navigation, search

Go Up to Modeling Concepts

Refactoring means rewriting existing source code with the intent of improving its design rather than changing its external behavior. The focus of refactoring is on the structure of the source code, changing the design to make the code easier to understand, maintain, and modify.

The refactoring features affect both source code and UML model. After refactoring both source code and UML models in your project become more consistent.

All refactoring operations are available from the Code Editor. However, the Modeling provides support for several refactoring operations (Refactoring Overview) in your implementation projects. These operations can be activated from the Diagram View and Model View:

Operation Description

Extracting Interfaces

The Extract Interface command creates a new interface from one or more selected classes. Each selected class should implement the interface.

Extracting Superclass

The Extract Superclass command creates an ancestor class from several members of a given class.

Creating Inline Variables

If you have a temporary variable that is assigned once with a simple expression, you can replace all references to that variable with the expression using the Inline Variable command.

Introducing Variables

Creates a new variable.

Introducing Fields

Creates a new field.

Moving Members

Moving members only applies to the static methods, static fields, and static properties (static members).

Pull Members Up
and
Push Members Down

Use the Pull Members Up command to copy a member (field, method, property, and event) from a subclass to a superclass, optionally making it abstract. If there are no superclasses, an error message is displayed.
Use the Push Members Down command to copy a member (field, method, property, and event) from a superclass to a subclass, optionally making it abstract. If there are no subclasses, an error message is displayed. Indexers cannot be pushed down.

Safe Delete

The Safe Delete command searches your code for any usages of the element that you want to delete.


See Also