Refactoring: Improving the Design of Existing Code (2nd Edition)

by Martin Fowler

Refactoring: Improving the Design of Existing Code (2nd Edition) by Martin Fowler

Refactoring: Improving the Design of Existing Code (2nd Edition), written by Martin Fowler, provides an easy-to-understand, step-by-step guide for improving the design of existing code. In his book, Fowler provides invaluable advice as to how to effectively refactor code, which aids in software maintainability, reducing code duplication, aiding in code readability, and more.

Refactoring is the process of editing existing source code to improve its maintainability, readability, and the overall performance of the software. It involves changing the structure and operation of a program in order to achieve a desired result without modifying its external behavior. Over time, bad code can accumulate in an application, or the underlying technology or coding language may diverge from an accepted standard, leading to an unmaintainable program. Refactoring code can help to fix these problems and make software more stable and secure.

In order to help people understand refactoring and why it should be done, Fowler has written a book that outlines all of the essential principles and techniques one should use. It starts by introducing refactoring and dives into a catalogue of metrics to analyze an existing code base, as well as patterns for improving code.

Fowler then proceeds through an in-depth technical tutorial that covers the various types of refactoring and their nuances. The book covers each refactoring pattern in detail, presenting examples of how to properly refactor code and explaining the various benefits of each approach. Fowler even provides code examples in multiple languages throughout the book to demonstrate each pattern.

Fowler also explains how tests should be used to ensure that incorrect changes are not made during the refactoring process. He outlines how existing tests can be modified and new tests created to guarantee that refactoring changes have the expected effect. He also explains when it is beneficial to create a baseline before refactoring, which allows you to track the impact of the changes.

The book also dives into the tools necessary to effectively refactor code. It discusses the various tools that can be used to create and manage refactoring operations, as well as popular source control systems like Git and Subversion. Fowler also provides a comprehensive introduction to refactoring for two popular development environments: Eclipse and Visual Studio.

Finally, Fowler concludes the book with a few appendices on specific refactoring cases (like databases and REST APIs) and provide references for a few other topics.

Overall, Refactoring: Improving the Design of Existing Code (2nd Edition) is an essential read for anyone interested in effective software design. Martin Fowler's easy-to-follow guide provides a comprehensive introduction to refactoring and its nuances, highlighting the numerous benefits of using the technique. With this book, readers will be able to properly identify when refactoring should be used and the best techniques to adress the task. In addition, there are plenty of useful tips and tricks to help you effectively use refactoring in your own projects.