Home

Refactoring Code

Refactoring refers to the process of restructuring code while maintaining current behavior. Simply Fortran currently only offers one automated refactoring tool.

Renaming

Simply Fortran can automatically rename a most programming elements in Fortran code, updating both its definition and all references to the element within a project. The following Fortran elements are supported by automatic renaming:

  • program
  • module
  • subroutine
  • function
  • local and module-level variables
  • variables as members of common blocks

To initiate renaming, the name of the element must first be selected a the point of it’s definition within an editor tab. By right-clicking, users can open the context menu and select Rename… After some calculations whose length depend on the complexity of the current project, this process will open the Rename dialog:

Rename Dialog

The user can enter an updated name for the selected element. The Affected Files box lists all project files that are about to be modified in the renaming procedure. If any file should remain unchanged, it can be deselected.

When the Ok button is clicked, the refactoring process is launched in the background, handling the automatic renaming. For files that are not currently opened in editor tabs, the changes will be written directly to disk. For unmodified files currently open in editor tabs, the changes will be written similarly, and the files will automatically be reloaded in their respective tabs.

For files in a modified and unsaved state in an editor tab, the changes from the automatic refactoring will be applied in the current editor tab, but the changes will not be automatically saved to disk. The user is left to save these modified files manually so as to not lose his or her current changes in the tab.

See Also

Editing in Simply Fortran