Refactoring 101

A presentation at Pacific Northwest PHP in in Seattle, WA, USA by Adam Culp

Refactor is the practice of altering code to make it cleaner, simpler, and sometimes faster, while not altering functionality. We’ll talk about how to do it better, and discuss: When to refactor. How to refactor. Why refactor. How a refactor can help us write better code in the future. Show a common methodology and steps to follow while refactoring, and resources to help us all on our refactor journey.


The following code examples from the presentation can be tried out live.

  • Refactoring 101 code

    The code here, represented as steps, is the progression of a refactoring on a legacy codebase. It is a PHP equivalent of the Java code shown in the Martin Fowler book “Refactoring”.