Refactoring#

Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior.

Martin Fowler

Code Smells#

Code smells are certain structures in the code that are not necessarily wrong, but still potentially indicate deeper problems. They are usually not bugs; they are not technically incorrect and do not currently prevent the program from functioning. However, they indicate weaknesses in design that may be slowing down development or increasing the risk of bugs or failures in the future.

Martin Fowler - Refactoring

Refuctoring#

Below a few sketches of how to not do it making it clear hou you should do it.

Refactoring checklist#

  • You can download a refactoring / code smell checklist here.