Code Smells

A Catalog of Wisdom about Hazards in Code — C Edition

Art for Code Smells Check Out A Preview

By Joshua Kerievsky, C. Keith Ray

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
  • 111 pages
  • 17 Code Smells
  • 17 Quizzes
  • 4 Videos
  • Dozens of real-world examples

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 Function 47
Long Function Example 48
Long Function Makeover 49
Why Do People Write Long Functions? 50
Long Function Survey 51
Large Module 53
Large Module Quiz 54
Dead Code 56
Removing Dead Code 57
Dead Code Example 58
Dead Code Survey ← Click to Preview 59
Oddball Solution 61
Oddball Solution Example 62
Majority Or Minority Oddball? 63
Oddball Solution Quiz 64
Primitive Obsession 66
Example: Repetitiveness 67
Example: Awkwardness 68
Primitive Obsession Survey 69
Switch Statement 71
Switch Statement Example 72
Refactoring the Switch Statement 73
A False Case of a Switch Statement Smell 74
Maps Instead of Switch Statements 75
Switch Statement Quiz 76
Long Parameter List ← Click to Preview 78
Default Values & Better Alternatives 79
Conditional Complexity 81
Conditional Complexity Example 82
Conditional Complexity Quiz 83
Inappropriate Intimacy 85
Inappropriate Intimacy Example 1 86
Inappropriate Intimacy Example 2 87
Inappropriate Intimacy Quiz 88
Indecent Exposure 90
Indecent Exposure Example 91
Indecent Exposure Quiz 92
Solution Sprawl 94
Solution Sprawl Example 95
A Solution Sprawl Solution 96
Solution Sprawl Quiz 97
Feature Envy 99
Feature Envy Example ← Click to Preview 100
Feature Envy Quiz 101
Temporary Field 103
Temporary Field Example 104
Temporary Field Quiz 105
Side Effect 107
When Are Side Effects Ok? 108
Side Effect Example 109
Conclusion - What’s Next? 111

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
  • 111 pages
  • 17 Code Smells
  • 17 Quizzes
  • 4 Videos
  • Dozens of real-world examples

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 Function 47
Long Function Example 48
Long Function Makeover 49
Why Do People Write Long Functions? 50
Long Function Survey 51
Large Module 53
Large Module Quiz 54
Dead Code 56
Removing Dead Code 57
Dead Code Example 58
Dead Code Survey ← Click to Preview 59
Oddball Solution 61
Oddball Solution Example 62
Majority Or Minority Oddball? 63
Oddball Solution Quiz 64
Primitive Obsession 66
Example: Repetitiveness 67
Example: Awkwardness 68
Primitive Obsession Survey 69
Switch Statement 71
Switch Statement Example 72
Refactoring the Switch Statement 73
A False Case of a Switch Statement Smell 74
Maps Instead of Switch Statements 75
Switch Statement Quiz 76
Long Parameter List ← Click to Preview 78
Default Values & Better Alternatives 79
Conditional Complexity 81
Conditional Complexity Example 82
Conditional Complexity Quiz 83
Inappropriate Intimacy 85
Inappropriate Intimacy Example 1 86
Inappropriate Intimacy Example 2 87
Inappropriate Intimacy Quiz 88
Indecent Exposure 90
Indecent Exposure Example 91
Indecent Exposure Quiz 92
Solution Sprawl 94
Solution Sprawl Example 95
A Solution Sprawl Solution 96
Solution Sprawl Quiz 97
Feature Envy 99
Feature Envy Example ← Click to Preview 100
Feature Envy Quiz 101
Temporary Field 103
Temporary Field Example 104
Temporary Field Quiz 105
Side Effect 107
When Are Side Effects Ok? 108
Side Effect Example 109
Conclusion - What’s Next? 111

Related Items