Refactoring

Sebastian BergmannArne BlankertsStefan Priebsch |

Test-Driven Development has a Red-Green-Refactor cycle. First you write down your expectation as test code, then you make that test green. Writing code that works is hard enough, therefore we often fail at making it "pretty" at the same time. That is why we often end up with code that works, but is hard to maintain. Refactoring to the rescue.

Refactoring

Martin Fowler explains:

"Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior."

This works great if your code it covered by automated tests. But what if your legacy application has no unit tests? In their live coding session at The Online PHP Conference, Arne and Stefan will demonstrate how to refactor existing code and how to use characterization tests to safeguard these changes.

More about Stefan's and Arne's live coding session