thePHP.cc Logo Deutsch Contact
mood

Refactoring

means improving the structure of software without changing the externally observable behaviour. Each individual refactoring step, for example the introduction of a new method or the renaming of a variable, is small and can therefore be implemented with little risk. However, the positive effect on the design and readability of software after a series of refactoring steps is significant.

A refactoring step is motivated by a so-called code smell . These are signs that indicate a possible change or improvement in the code. Often it is also an accumulation of such signs or smells that motivate a refactoring. A code smell does not necessarily mean a problem or even an error, but it is an indicator that the code should be changed.

Martin Fowler has described the methodical approach very well in his book "Refactoring: Improving the Design of Existing Code". A short overview of the different refactoring patterns can also be found on the book's website .

Good IDEs support automatic refactorings. This saves time and helps to avoid errors. There are also development tools that offer automated refactorings, for example Rector .

Refactoring is an integral part of the Red/Green/Refactor cycle in Test-Driven Development .

Article Disintegration Testing More articles
Article Integration Testing More articles
Presentation The Driven Developer More presentations