Improving a computer programby reorganising its internal structure without altering its external behaviour.
When software developers add new featuresto a program, the code degrades because the original program was not designed with the extra features in mind.
This problem could be solved by either rewriting the existing code or working around the problems which arise when adding the new features. Redesigning a program is extra work, but not doing so would create a program which is more complicated than it needs to be. Refactoring is a collection of techniques which have been designed to provide an alternative to the two situations mentioned above.
The techniques enable programmers to restructure code so that the design of a program is clearer. It also allows programmers to extract reusable components, streamline a program, andmake additions to the program easier to implement.