Chapter 4. Code Smells

When you have learned to look at your words with critical detachment, you will find that rereading a piece five or six times in a row will each time bring to light fresh spots of trouble. [Barzun, 229]

Refactoring, or improving the design of existing code, requires that you know what code needs improvement. Catalogs of refactorings help you gain this knowledge, yet your situation may be different from what you see in a catalog. It’s therefore necessary to learn common design problems so you can recognize them in your own code.

The most common design problems result from code that

•  Is duplicated

•  Is unclear

•  Is complicated

These criteria can certainly help you discover places in code that need improvement. On the ...

Get Refactoring to Patterns 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.