C H A P T E R  7

image

Structuring Behavior

A big problem in taming the beast of old legacy code often arises from a method's length. Methods can be too long, too short, overused, or underused. Long methods are hard to keep in mind at once with all their meaning, while short ones can be not meaningful enough. Misused methods can compromise a clean structure by adding unwanted complexity.

In both cases we have to refactor our code to improve its readability, its logical structure, and to keep undesired complexity out of our way. Most of the refactoring techniques we'll see in this book are based on the collection of refactoring methods published by ...

Get Pro PHP Refactoring now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.