7 REFACTORING

He who rejects change is the architect of decay. The only human institution which rejects progress is the cemetery.

—Harold Wilson

7.1 GENERAL IDEA

Developers continuously modify, enhance, and adapt software to new requirements and execution environments. The software evolves with time, and, most likely, it deviates from its intended design. As the software further evolves and strays too far away from its original design, three important things happen to the software:

  • Decreased understandability: It becomes increasingly difficult to understand the software and it becomes less maintainable.
  • Decreased reliability: The reliability of the software decreases. As the software deviates from its original design and as documentations become out-of-date, faults are inadvertently introduced into the software during maintenance.
  • Increased maintenance cost: The cost of maintaining the software rises in the absence of preventive measures.

The difficulty in understanding the software is due to the:

  • increased complexity of the code during the maintenance phase;
  • out-of-date documentation;
  • code not conforming to standards.

Therefore, there is a need to decrease the complexity of software by improving its internal quality. The internal quality of software is improved by means of restructuring the software. If restructuring is performed on an object-oriented software, then it is called refactoring [1]. Software should be continually restructured during and between other maintenance ...

Get Software Evolution and Maintenance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.