Refactoring is a technique for restructuring code in a way that you improve the design, but don’t change the its external behaviour.
It is done applying a serie of small transformations to the code (called a “refactor”), and using test to ensure the external behaviour never changes.
Thanks that each refactor is small, if something goes wrong and a test fails, is easy go back, undo the changes, minimizing the probability that a bug can be introduced.


