Comment Re:Easier to Analyze or Change == More Maintainabl (Score 2) 247
So I have a method that brute forces something, then I go back and figure out how to do it with a better big 0, and the functionality doesn't change, but that still isn't refactoring, because
Because it violates the standard definition of "refactoring".
Refactoring is about changing the structure of the code, and not the algorithms used within the code. The goal is typically to reduce coupling, increase cohesion, and (frequently) to improve testability.
Replacing an algorithm with a better algorithm isn't "refactoring", it's "rewriting".
Taking your giant brute-force method and breaking it into smaller parts in a cohesive unit (source file, class, package, etc.) with lowered coupling (perhaps by genericizing previously tightly-coupled bits), in such a way that the individual units have a smaller testing surface -- but is otherwise the same algorithm -- then you've refactored the code, by definition.
Yaz