Search code examples
refactoring

Is changing class name considered refactoring?


To avoid confusion between the different names of parent classes and child classes, I decided to change the name of the parent class to something more suitable. When I commit this change, should the commit message on git start with "Refactor ..."?


Solution

  • Yes, renaming is considered an act of refactoring according to many people, including Martin Fowler, author of the book Refactoring.

    For example:

    From Refactoring source code in Visual Studio Code:

    Renaming is a common operation related to refactoring source code

    From Rename refactorings | IntelliJ IDEA Documentation:

    Renaming local variables or private methods can be done easily inline since only the limited scope is affected. Renaming classes or public methods could potentially impact a lot of files. Preview potential changes before you refactor.