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. Refactoring is not rewriting. Refactoring is typically done in small steps. After each small step, you're left with a working system that's functionally unchanged. The advantages of refactoring include improved code readability and reduced complexity to improve source code maintainability, and create a more expressive internal architecture or object model to improve extensibility.