Refactoring in Modeling
Go Up to Introductory 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 |
---|---|
The Extract Interface command creates a new interface from one or more selected classes. Each selected class should implement the interface. | |
The Extract Superclass command creates an ancestor class from several members of a given class. | |
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. | |
Creates a new variable. | |
Creates a new field. | |
Moving members only applies to the static methods, static fields, and static properties (static members). | |
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. | |
The Safe Delete command searches your code for any usages of the element that you want to delete. |