By Joshua Kerievsky

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?

Highlights

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...

Includes

  • 4-6 hours of content
  • 159 pages
  • 22 Code Smells
  • 28 Quizzes
  • 10 Videos
  • Platform-independent code samples
  • Dozens of real-world examples
  • Finding smells in legacy code

Contents

You Are Here 3
Welcome To Code Smells 4
Connoisseurs of Code ← Click to Preview 5
How Sensitive Is Your Nose? 6
Introduction To Code Smells 7
What Are Code Smells? 8
A Short History Of Code Smells 9
Technical Debt 11
Credit Card Debt 12
Is Your Code In Debt? 13
What Does Technical Debt Look Like? ← Click to Preview 14
Decreasing Customer Responsiveness 15
Technical Debt At Two Organizations 16
Managing Technical Debt, A Short Quiz 17
Big Picture Cost of Technical Debt 18
Lost Intent 20
Lost Intent Example 21
Intention-Revealing Code 22
Losing Your Intention Quiz 23
Inefficient Name 25
Optimizing Program(mer) Performance 26
The Goal: Reveal Intention 27
Perfect: Simple, Consistent, Accurate 28
Typing Is Not The Bottleneck 29
Fixing Inefficient Name 30
This Or That Quiz 31
Duplicated Code 33
Blatant Duplication 34
Subtle Duplication 35
Don’t Repeat Yourself 36
Duplicated Code Quiz 37
When is it Okay to Copy Code? 38
Deodorant Comment ← Click to Preview 40
Comment Guidelines 41
Comment Quiz 42
A Comment Judgment Call 43
Other Deodorants 44
Long Method 46
Long Method Makeover 47
What About Performance? 48
Long Methods and Performance 49
Why Do People Write Long Methods? 50
Long Method Quiz 51
Large Class 53
Large Class Quiz 54
Dead Code 56
Removing Dead Code 57
Dead Code Example 58
Dead Code Quiz ← Click to Preview 59
Lazy Class 61
How Lazy? 62
Baby Classes 63
Lazy Class Quiz 64
Refactoring Common Smells 66
Oddball Solution 68
Oddball Solution Example 69
Majority Or Minority Oddball? 70
Oddball Solution Quiz 71
Primitive Obsession 73
Primitive Obsession Example: Awkwardness 74
Primitive Obsession Example: Repetitiveness 75
Primitive Obsession Survey 76
Switch Statement 78
Switch Statement Example 79
Replacing Switch Statements With Polymorphism 80
A False Case Of A Switch Statement Smell 81
Maps Instead of Switch Statements 82
Switch Statement Quiz 83
Speculative Generality 85
Speculative Generality Example 86
Speculative Generality Quiz 87
Refactoring More Common Smells 89
Conditional Complexity 94
Conditional Complexity Example 95
Conditional Complexity Solution 96
Conditional Complexity Sprawl 97
Conditional Complexity Quiz 98
Combinatorial Explosion 100
A Combinatorial Explosion of Methods 101
A Combinatorial Explosion of Classes 102
Combinatorial Explosion Quiz 103
Alternative Classes With Different Interfaces ← Click to Preview 105
An Example Of Alternative Classes With Different Interfaces 106
Adapting A Class With A Different Interface 107
Inappropriate Intimacy 109
Inappropriate Intimacy Example 1 110
Inappropriate Intimacy Example 2 111
Inappropriate Intimacy Quiz 112
Indecent Exposure 114
Indecent Exposure Example 115
Indecent Exposure Quiz 116
Refused Bequest 118
Refused Bequest Example 119
Refused Bequest Quiz 120
Black Sheep 122
Black Sheep Method Example 123
Data Class 125
When Are Data Classes Good? 126
Evolving Away From A Data Class 127
Solution Sprawl 129
Solution Sprawl Example 130
A Solution Sprawl Solution 131
Solution Sprawl Quiz 132
Temporary Field 138
Temporary Field Example 139
Temporary Field Quiz 140
Side Effect 142
When Are Side Effects Ok? 143
Side Effect Example 144
Refactoring More Uncommon Smells Quiz 146
Smellections Introduction 148
The Smellections Scavenger Hunt 149
The Solutions in Depth 150
Smells In Collection 151
Smells In AbstractList and AbstractSet 152
Smells In AbstractCollection 153
Smells In List 154
Smells In Set 155
Smells In Map ← Click to Preview 156
Smellections Hunt Conclusion 157
Conclusion - What's Next? 159

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.