...
Code refactoring is the process of restructuring existing computer code—changing its structure—without changing its external behavior. The goal of refactoring is to improve the design, structure, and/or implementation of the software (its non-functional attributes), while preserving its functionality.
...
Refactoring can be driven by different needs:
...
Martin Fowler's book, "Refactoring: Improving the Design of Existing Code", is considered the foundational work on this topic.
Code Smells
...
"Code smells" is a term coined by Kent Beck in the book "Refactoring: Improving the Design of Existing Code" by Martin Fowler. A code smell is a surface indication that usually corresponds to deeper problems in a system. They're not bugs or errors; rather, they're characteristics in the source code that suggest poor design or poor coding practices which may slow down development, increase the risk of bugs, or complicate modifications or extensions of the system.
...