By Joshua Kerievsky, Tim Ottinger

How do you distinguish great software design from poor software design? Code Smells go beyond vague programming principles by capturing industry wisdom about how not to design code. If you'd like to become skilled at Refactoring, you need to develop your ability to identify Code Smells. Study a collection of important Code Smells and compare each one to a simpler, cleaner design.

Get this Album

Volume Licensing

Have Any Questions?


Hazardous Designs: Produce safer code by understanding a catalog of hazardous software designs. Learn more...
Integrated Forums: Ask questions, get expert replies and read fascinating discussions. Learn more...

Expert Videos: Learn tools & techniques by watching short videos from industry experts. Learn more...


  • 4-6 hours of content
  • 155 pages
  • 22 Code Smells
  • 28 Quizzes
  • 3 Videos
  • Dozens of real-world examples
  • Finding smells in legacy code


You Are Here 3
Welcome to Code Smells 4
Connoisseurs of Code ← Click to Preview 5
How Sensitive Is Your Nose? 6
What Are Code Smells? 7
A Short History of Code Smells 8
Technical Debt 10
Credit Card Debt 11
Is Your Code in Debt? 12
What Does Technical Debt Look Like? 🎦 ← Click to Preview 13
Decreasing Customer Responsiveness 14
Technical Debt at Two Organizations 15
Managing Technical Debt, A Short Quiz 16
Big Picture Cost of Technical Debt 17
Lost Intent 19
Lost Intent Example 20
Intention-Revealing Code 21
Losing Your Intention Quiz 22
Inefficient Name 24
Optimizing Program(mer) Performance 🎦 25
The Goal: Reveal Intention ← Click to Preview 26
Perfect: Simple, Consistent, Accurate 27
Typing Is Not the Bottleneck 28
Fixing Inefficient Names 29
This or That Quiz 30
Duplicated Code 32
Blatant Duplication 33
Subtle Duplication 34
Don’t Repeat Yourself 35
Duplicated Code Quiz 36
When is it Okay to Copy Code? 37
Deodorant Comment ← Click to Preview 39
Comment Guidelines 40
Comment Quiz 41
A Comment Judgment Call 42
Other Deodorants 43
Long Method 45
Long Method Example 46
Long Method Makeover 47
What About Performance? 48
Why Do People Write Long Methods? 49
Long Method Quiz 50
Large Class 52
Large Class Quiz 53
Dead Code 55
Removing Dead Code 56
Dead Code Example 57
Dead Code Quiz ← Click to Preview 58
Lazy Class 60
How Lazy? 61
Baby Classes 62
Lazy Class Quiz 63
Refactoring Common Smells 65
Oddball Solution 67
Oddball Solution Example 68
Majority Or Minority Oddball? 69
Oddball Solution Quiz 70
Primitive Obsession 72
Example: Repetitiveness 73
Example: Awkwardness 74
Primitive Obsession Survey 75
Switch Statement 77
Switch Statement Example 78
Replacing Switch Statements With Polymorphism 79
A False Case of a Switch Statement Smell 80
Maps Instead of Switch Statements 81
Switch Statement Quiz 82
Speculative Generality 84
Speculative Generality Example 85
Speculative Generality Quiz 86
Refactoring More Common Smells 88
Conditional Complexity 93
Conditional Complexity Example 94
Conditional Complexity Solution 95
Conditional Complexity Sprawl 96
Conditional Complexity Quiz 97
Combinatorial Explosion 99
A Combinatorial Explosion of Methods 100
A Combinatorial Explosion of Classes 101
Combinatorial Explosion Quiz 102
Alternative Classes With Different Interfaces ← Click to Preview 104
An Example of Alternative Classes with Different Interfaces 105
Adapting a Class with a Different Interface 106
Inappropriate Intimacy 108
Inappropriate Intimacy Example 1 109
Inappropriate Intimacy Example 2 110
Inappropriate Intimacy Quiz 111
Indecent Exposure 113
Indecent Exposure Quiz 114
Refused Bequest 116
Refused Bequest Example 117
Refused Bequest Quiz 118
Black Sheep 120
Black Sheep Method Example 121
Data Class 123
When Are Data Classes Good? 124
Evolving Away From A Data Class 125
Solution Sprawl 127
Solution Sprawl Example 🎦 128
A Solution Sprawl Solution 129
Solution Sprawl Quiz 130
Temporary Field 136
Temporary Field Example 137
Temporary Field Quiz 138
Side Effect 140
When Are Side Effects Ok? 141
Side Effect Example 142
Refactoring More Uncommon Smells Quiz 144
Dull Formatting 146
Follow The Masters - PEP8 147
Lousy Names 148
Overblown Solutions 149
Dull Formatting and Lousy Names Quiz 150
Scavenger Hunt Introduction 152
The Smells Scavenger Hunt 153
Conclusion - What’s Next? 155

Related Items

Supported Browsers

  • Latest Firefox
  • Internet Explorer 8+
  • Latest Chrome
  • Latest Safari

Operating Systems

  • Windows
  • Linux
  • Mac OS X

Development Tools

You can use whatever developments tools you prefer. If you do use an IDE (Integrated Development Environment), many (though not all) of our labs come with projects pre-configured for Eclipse, IntelliJ and Visual Studio.

Speakers or headphones are required for our videos.

Flash is required to view charts or watch videos — download for free.