0

Is renaming variables a type of refactoring, or is refactoring something different? In other words, what's the difference between renaming and refactoring? I thought they were the same thing.

"Code refactoring" mentions renaming only here:

Rename method or rename field – changing the name into a new one that better reveals its purpose

But it doesn't mention renaming variables.

2
  • 3
    Hello Geremia, askers on this site are expected to do some research before they ask. Unfortunetale, the question in the current state gives the impression of absolutely zero research effort, but maybe you did some and just forgot to mention? So please tell us what you found and why it did not suit your needs, then we can probably give you a better answer.
    – Doc Brown
    Commented Nov 19, 2018 at 19:43
  • 1
    The difference between renaming and refactoring is the same as the difference between a green Toyota Corolla and a vehicle. Commented Nov 19, 2018 at 20:33

1 Answer 1

7

Renaming variables, functions, classes is in fact a type of refactoring (one of the simpler types). Renaming was cataloged as a type of refactoring in the classical text on refactoring by Martin Fowler.

Definition of refactoring:

Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure. [Martin Fowler]

Different kinds of refactoring fit this definition: from small and trivial ones which could take 5 minutes to large refactorings which take months.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.