Refactoring: Improving the Design of Existing Code

Although I bought refactoring book by Martin Fowler years ago it is still valid. I call it one of the timeless books about coding and I consider it as a mandatory reading specially for novice programmers who are entering the field. Of course it is also useful handbook for those already in business. This refactoring book covers and organizes most of changes we are doing to source code every day and it greatly helps us to understand the nature of those changes at crafting level.

Why consider refactoring book?

refactoring-martin-fowler
Buy from Amazon

This book by Martin Fowler is something that serious developers should read when learning hardcore coding. Big part of our actual coding work is improving existing code and this is what this book is about. It organizes our most important code changing activities and describes these in detail.

Some developers may ask – why to describe what we are doing everyday if we are learned how to do our job? Well, the knowledge in this book comes from practice and not from theory. I went through this book years ago when I already had been in coding around ten years and this book still had many tricks to offer plus some many details to get me to better understanding about changes in code.

In my opinion this book is worth buying as hardcover paper book because it is useful as long as coding has not changed to something totally different from what it is now.

Table of contents

Foreword
Preface

  1. Refactoring, a First Example
  2. Principles in Refactoring
  3. Bad Smells in Code
  4. Building Tests
  5. Toward a Catalog of Refactorings
  6. Composing Methods
  7. Moving Features Between Objects
  8. Organizing Data
  9. Simplifying Conditional Expressions
  10. Making Method Calls Simpler
  11. Dealing with Generalization
  12. Big Refactorings
  13. Refactoring, Reuse, and Reality
  14. Refactoring Tools
  15. Putting It All Together

References
List of Soundbites
Index

Refactorings covered in this book

Composing Methods: Extract method, Inline Method, Inline Temp, Replace Temp with Query, Introduce Explaining Variable, Split Temporary Variable, Remove Assignment to Parameters, Replace Method with Method Object, Substitute Algorithm.

Moving Features Between Objects: Move Method, Move Field, Extract Class, Inline Class, Hide Delegate, Remove Middle Man, Introduce Foreign Method, Introduce Local Extension.

Organizing Data: Self Encapsulate Field, Replace Data Value with Object, Change Value to Reference, Change Reference to Value, Replace Array with Object, Duplicate Observed Data, Change Unidirectional Association to Bidirectional, Change Bidirectional Association to Unidirectional, Replace Magic Number with Symbolic Constant, Encapsulate Field, Encapsulate Collection, Replace Recod with Data Class, Replace Type Code with Class, Replace Type Code with Subclasses, Replace Type Code with State/Strategy.

SImplifying Conditional Expressions: Decompose conditional, Consolidate Conditional Expression, Consolidate Duplicate Conditional Fragments, Remove Control Flag, Replace Nested Conditional with Guard Clauses. Replace Conditional with Polymorphism, Introduce Null Object, Introduce Assertion.

Making Method Calls Simpler: Rename Method, Add Parameter, Remove Parameter, Separate Query from Modifier, Parameterize Method, Replace Parameter with Explicit Methods, Preserve Whole Object, Replace Parameter With Method, Introduce Parameter Object, Remove Setting Method, Hide Method, Replace Constructor with Factory Method, Encapsulate Downcast, Replace Error Code with Exception, Replace Exception with Test.

Dealing with Generalization: Pull Up Field, Pull Up Method, Pull Up Constructor Body, Push Down Method, Push Down Field, Extract Subclass, Extract Superclass, Extract Interface, Collapse Hierarchy, Form Template Method, Replace Inheritance with Delegation, Replace Delegation with Inheritance.

Gunnar Peipman

Gunnar Peipman is ASP.NET, Azure and SharePoint fan, Estonian Microsoft user group leader, blogger, conference speaker, teacher, and tech maniac. Since 2008 he is Microsoft MVP specialized on ASP.NET.

    Leave a Reply

    Your email address will not be published. Required fields are marked *