Mathematical Origins of Refactoring
The term refactoring comes from computer science mathematical origins. Sometimes to re-organize code it’s necessary to expand things out - the code will initially expand much the same way if you expand out algebraic expressions.
So initially code might appear more messy and voluminous.
But then we can see patterns and commonalities and factor these out - much in the same way we refactor mathematical equations.
Also the process of refactoring is likely at the end of it to result in code which is mostly “rewritten” in that every line of code has been altered.
This is why I encourage teams I manage to realize it’s not the code which is the value - it’s the ideas in the code. See code dump.