What is refactoring?
As in alegebra, code (re)factoring doesn't change the meaning of an expression, only the representation.“Refactoring” of software seems to generate a lot of confusion.
“We need to refactor our eCommerce platform to accept Stripe payments.”
No, no, you don’t. That’s not a refactor. That’s a new feature!
A refactor doesn’t change the code’s behavior.
“Well then why would we bother with a refactor?”
We do refactoring because it makes future changes easier. Or becase it makes the code easier to understand.
It’s the same in algebra. (Re)factoring doesn’t change the meaning of an expression, it only changes the representation.