Refactoring: Improving the Design of Existing Code

Book

Thumbnail
Refactoring is about improving the design of existing code. It is the process of changing a software system in such a way that it does not alter the external behavior of the code, yet improves its internal structure. With refactoring you can even take a bad design and rework it into a good one. This book offers a thorough discussion of the principles of refactoring, including where to spot opportunities for refactoring, and how to set up the required tests.

Get more Information

Authors

Patterns

Encapsulate Field

Refactoring

Refactor a private field so that it can only be accessed using getter or setter methods. The advantage is that the accessors can be extended with additional logic without recompiling the client.

Extract Class

Refactoring

Create a new class and move the relevant fields and methods from the old class into the new class.

Extract Method

Refactoring

Extract a code fragment into a new method whose name explains its purpose. The refactoring is a way remove code comments and create small methods.