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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access