Code Smells

A Catalog of Wisdom about Hazards in Code — C# Edition

Art for Code Smells Check Out A Preview

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.

Highlights

Hazardous Designs
Hazardous Designs: Produce safer code by understanding a catalog of hazardous software designs. Learn more...
Integrated Forums
Integrated Forums: Ask questions, get expert replies and read fascinating discussions. Learn more...
Expert Videos
Expert Videos: Learn tools & techniques by watching short videos from industry experts. Learn more...

Includes

  • 4-6 hours of content
  • 160 pages
  • 22 Code Smells
  • 28 Quizzes
  • 10 Videos
  • 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 Survey 23
Inefficient Name 25
Optimizing Program(mer) Performance 26
The Goal: Reveal Intention ← Click to Preview 27
Perfect: Simple, Consistent, Accurate 28
Typing Is Not the Bottleneck 29
Fixing Inefficient Names 30
This or That Survey 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
Useless Comment 41
Comment Guidelines 42
Comment Quiz 43
A Comment Judgment Call 44
Other Deodorants 45
Long Method 47
Long Method Makeover 48
What About Performance? 49
Long Methods and Performance 50
Why Do People Write Long Methods? 51
Long Method Survey 52
Large Class 54
Large Class Quiz 55
Dead Code 57
Removing Dead Code 58
Dead Code Example 59
Dead Code Survey ← Click to Preview 60
Lazy Class 62
How Lazy? 63
Baby Classes 64
Lazy Class Survey 65
Refactoring Common Smells 67
Oddball Solution 69
Oddball Solution Example 70
Majority Or Minority Oddball? 71
Oddball Solution Quiz 72
Primitive Obsession 74
Example: Repetitiveness 75
Example: Awkwardness 76
Primitive Obsession Survey 77
Switch Statement 79
Switch Statement Example 80
Replacing Switch Statements With Polymorphism 81
A False Case of a Switch Statement Smell 82
Maps Instead of Switch Statements 83
Switch Statement Quiz 84
Speculative Generality 86
Speculative Generality Example 87
Speculative Generality Quiz 88
Refactoring More Common Smells 90
Long Parameter List ← Click to Preview 92
Default Values & Better Alternatives 93
Conditional Complexity 95
Conditional Complexity Example 96
Conditional Complexity Solution 97
Conditional Complexity Sprawl 98
Conditional Complexity Quiz 99
Combinatorial Explosion 101
A Combinatorial Explosion of Methods 102
A Combinatorial Explosion of Classes 103
Combinatorial Explosion Quiz 104
Alternative Classes With Different Interfaces ← Click to Preview 106
An Example of Alternative Classes with Different Interfaces 107
Adapting a Class with a Different Interface 108
Inappropriate Intimacy 110
Inappropriate Intimacy Example 1 111
Inappropriate Intimacy Example 2 112
Inappropriate Intimacy Quiz 113
Indecent Exposure 115
Indecent Exposure Example 116
Indecent Exposure Quiz 117
Refused Bequest 119
Refused Bequest Example 120
Refused Bequest Quiz 121
Black Sheep 123
Black Sheep Method Example 124
Data Class 126
When Are Data Classes Good? 127
Evolving Away From A Data Class 128
Solution Sprawl 130
Solution Sprawl Example 131
A Solution Sprawl Solution 132
Solution Sprawl Quiz 133
Feature Envy 135
Feature Envy Example ← Click to Preview 136
Feature Envy Quiz 137
Temporary Field 139
Temporary Field Example 140
Temporary Field Quiz 141
Side Effect 143
When Are Side Effects Ok? 144
Side Effect Example 145
Refactoring More Uncommon Smells Quiz 147
Smellections Introduction 149
The Smellections Scavenger Hunt 150
The Solutions in Depth 151
Smells in Collection 152
Smells in AbstractList and AbstractSet 153
Smells in AbstractCollection 154
Smells in List 155
Smells in Set 156
Smells in Map ← Click to Preview 157
Smellections Hunt Conclusion 158
Conclusion - What’s Next? 160

Related Items

Volume Licensing

Have Any Questions?

Highlights

Hazardous Designs
Hazardous Designs: Produce safer code by understanding a catalog of hazardous software designs. Learn more...
Integrated Forums
Integrated Forums: Ask questions, get expert replies and read fascinating discussions. Learn more...
Expert Videos
Expert Videos: Learn tools & techniques by watching short videos from industry experts. Learn more...

Includes

  • 4-6 hours of content
  • 160 pages
  • 22 Code Smells
  • 28 Quizzes
  • 10 Videos
  • 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 Survey 23
Inefficient Name 25
Optimizing Program(mer) Performance 26
The Goal: Reveal Intention ← Click to Preview 27
Perfect: Simple, Consistent, Accurate 28
Typing Is Not the Bottleneck 29
Fixing Inefficient Names 30
This or That Survey 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
Useless Comment 41
Comment Guidelines 42
Comment Quiz 43
A Comment Judgment Call 44
Other Deodorants 45
Long Method 47
Long Method Makeover 48
What About Performance? 49
Long Methods and Performance 50
Why Do People Write Long Methods? 51
Long Method Survey 52
Large Class 54
Large Class Quiz 55
Dead Code 57
Removing Dead Code 58
Dead Code Example 59
Dead Code Survey ← Click to Preview 60
Lazy Class 62
How Lazy? 63
Baby Classes 64
Lazy Class Survey 65
Refactoring Common Smells 67
Oddball Solution 69
Oddball Solution Example 70
Majority Or Minority Oddball? 71
Oddball Solution Quiz 72
Primitive Obsession 74
Example: Repetitiveness 75
Example: Awkwardness 76
Primitive Obsession Survey 77
Switch Statement 79
Switch Statement Example 80
Replacing Switch Statements With Polymorphism 81
A False Case of a Switch Statement Smell 82
Maps Instead of Switch Statements 83
Switch Statement Quiz 84
Speculative Generality 86
Speculative Generality Example 87
Speculative Generality Quiz 88
Refactoring More Common Smells 90
Long Parameter List ← Click to Preview 92
Default Values & Better Alternatives 93
Conditional Complexity 95
Conditional Complexity Example 96
Conditional Complexity Solution 97
Conditional Complexity Sprawl 98
Conditional Complexity Quiz 99
Combinatorial Explosion 101
A Combinatorial Explosion of Methods 102
A Combinatorial Explosion of Classes 103
Combinatorial Explosion Quiz 104
Alternative Classes With Different Interfaces ← Click to Preview 106
An Example of Alternative Classes with Different Interfaces 107
Adapting a Class with a Different Interface 108
Inappropriate Intimacy 110
Inappropriate Intimacy Example 1 111
Inappropriate Intimacy Example 2 112
Inappropriate Intimacy Quiz 113
Indecent Exposure 115
Indecent Exposure Example 116
Indecent Exposure Quiz 117
Refused Bequest 119
Refused Bequest Example 120
Refused Bequest Quiz 121
Black Sheep 123
Black Sheep Method Example 124
Data Class 126
When Are Data Classes Good? 127
Evolving Away From A Data Class 128
Solution Sprawl 130
Solution Sprawl Example 131
A Solution Sprawl Solution 132
Solution Sprawl Quiz 133
Feature Envy 135
Feature Envy Example ← Click to Preview 136
Feature Envy Quiz 137
Temporary Field 139
Temporary Field Example 140
Temporary Field Quiz 141
Side Effect 143
When Are Side Effects Ok? 144
Side Effect Example 145
Refactoring More Uncommon Smells Quiz 147
Smellections Introduction 149
The Smellections Scavenger Hunt 150
The Solutions in Depth 151
Smells in Collection 152
Smells in AbstractList and AbstractSet 153
Smells in AbstractCollection 154
Smells in List 155
Smells in Set 156
Smells in Map ← Click to Preview 157
Smellections Hunt Conclusion 158
Conclusion - What’s Next? 160

Related Items