Design Patterns Vol. 1

Foundational Patterns for Software Programmers — C++ Edition

Art for Design Patterns Vol. 1 Check Out A Preview

By Joshua Kerievsky, Brian Foote

The landmark Design Patterns is one of the best-selling computer science books ever. Simple constructors are the most basic way to construct objects, but real code often needs more sophisticated approaches. See how experts apply Template Method, Factory Method, Prototype, and others. The challenging exercises will stretch your skills.

Highlights

Instant Critiques
Instant Critiques: Take a refactoring exercise and get instant feedback from our automated band of experts. Learn more...
Foundational Patterns
Foundational Patterns: Learn the most widely-used patterns, including Template Method, Factory Method, Strategy and others. Learn more...
Expert Videos
Expert Videos: Learn tools & techniques by watching short videos from industry experts. Learn more...
Integrated Forums
Integrated Forums: Ask questions, get expert replies and read fascinating discussions. Learn more...

Includes

  • 5-7 hours of content
  • 145 pages of content
  • 8 Patterns
  • 7 Videos
  • 4 Exercises
  • 19 Quizzes
  • Platform-independent code
  • Support for Visual Studio
  • Support for Eclipse CDT
  • Uses Google Test

Contents

Patterns Help You to Program Like an Expert 3
Where Do Patterns Come From? 4
What Is a Pattern? 5
What are Patterns? 6
What are Design Patterns? 7
Inside Volume One ← Click to Preview 8
Patterns-Happy 9
Hello World? ← Click to Preview 10
Composed Method 12
The Essence of Composed Method 13
Composition and Performance 14
Composed Method: The Players 15
The Importance of Storytelling 16
Guidelines For Creating Composed Methods 17
Composed Method Motivation 18
Composed Method Objections 19
Template Method 21
The Essence of Template Method ← Click to Preview 22
Template Method: An Example 23
How Mike the Scalper Scores Tickets 24
A Template Method for Scoring Tickets 25
Template Method Players ← Click to Preview 26
Putting Meat on the Bones 27
Hackers and Customers Quiz 28
Refactoring to a Template Method 29
Composed Methods vs. Template Methods 30
Template Method Exercise ← Click to Preview 32
Understanding the Domain 33
Dealing With A Special Case 34
Problem Source Code 35
Critiquing Your Performance 36
Installing the Recorder 37
Download, Build & Test Instructions 38
Upload Your Exercise 39
A Graph of Your Refactoring & Testing Activity 40
Your Critique Results 41
Your Customized Feedback 42
Solution 43
Creation Method 45
The Facts of Life 46
Constructor Intents 47
Constructor Shortcomings 48
The Stork 49
Creation Method Players ← Click to Preview 50
Constructors and Creation Methods 51
A Class With Too Many Constructors! ← Click to Preview 53
Why Not Subclass Loan? 54
A Closer Look At Loan 55
Refactoring Loan 56
Download & Build Instructions 57
How We Solved The Exercise 58
Factory Method 60
The Essence of Factory Method 61
Factory Method Players 62
Creation Methods and Factory Methods 63
Factory Method: Fact or Fiction? 64
Example Code 65
The Ministry Of Software ← Click to Preview 66
Factory Method: Portfolio Quiz 67
Factory Method: How to Tell 68
Factory Method: Coupling Quiz 69
Factory Method Exercise ← Click to Preview 71
Problem Source Code 72
Refactoring Guidance 73
Critiquing Your Performance 74
Installing the Recorder 75
Download, Build & Test Instructions 76
Upload Your Exercise 77
A Graph of Your Refactoring & Testing Activity 78
Your Critique Results 79
Your Customized Feedback 80
Solution 81
Abstract Factory 83
An Automotive Abstract Factory 84
Abstract Factory Players ← Click to Preview 85
What is a Factory? 86
Abstract Factory vs. Factory 87
Strategy 89
The Essence of the Strategy Pattern 90
Avoiding a Subclass Explosion 91
Strategy: The Players 92
Strategy: A Simple Problem 93
Collaboration and Encapsulation 94
Cooperation and Visibility 95
Passing Data as Parameters 96
Passing the Entire Context 97
Pluggable Guts 98
Starting Your Own Family 99
Strategy: A Question of Values 100
Strategy: Freedom from Choice 101
Strategy: Sharing Your Strategies 102
Strategy: Accommodating Variety 103
Strategy Exercise 105
Problem Source Code 106
Critiquing Your Performance 107
Installing the Recorder 108
Download, Build & Test Instructions 109
Upload Your Exercise 110
A Graph of Your Refactoring & Testing Activity 111
Your Critique Results 112
Your Customized Feedback 113
Solution 114
Mechanics Step 1: Create Strategy Class 115
Mechanics Step 2: Pass Data Or Context? 116
Mechanics Step 2.1: Premature Move Method 117
Mechanics Step 2.2: Encapsulate Fields 118
Mechanics Step 2.3: Move Capital Method 119
Mechanics Step 2.4: Move Via Inline & Extract 120
Mechanics Step 2.5: Move Duration 121
Mechanics Step 2.6: Replace Variable With Field 122
Mechanics Step 3.0: Extract Parameter 123
Mechanics Step 4: Replace Conditional With Polymorphism ← Click to Preview 124
Mechanics Step 4.1: Push Down Calculation Behavior 125
Prototype 127
The Essence of Prototype 128
Why Clone? 129
The Players 130
Prototype Factory Example 131
Deep Copy Example 132
Prototype Quiz 133
Loan Quiz 134
Singleton 136
The Essence of Singleton 137
The Players 138
Pattern Luminaries on Singleton 139
The Evils of Singleton 140
When Is Singleton A Mistake To Use? 141
An Extended Example 142
Singleton Quiz 143
Monostate 144
Singleton and Concurrency 145

Related Items

Volume Licensing

Have Any Questions?

Highlights

Instant Critiques
Instant Critiques: Take a refactoring exercise and get instant feedback from our automated band of experts. Learn more...
Foundational Patterns
Foundational Patterns: Learn the most widely-used patterns, including Template Method, Factory Method, Strategy and others. Learn more...
Expert Videos
Expert Videos: Learn tools & techniques by watching short videos from industry experts. Learn more...
Integrated Forums
Integrated Forums: Ask questions, get expert replies and read fascinating discussions. Learn more...

Includes

  • 5-7 hours of content
  • 145 pages of content
  • 8 Patterns
  • 7 Videos
  • 4 Exercises
  • 19 Quizzes
  • Platform-independent code
  • Support for Visual Studio
  • Support for Eclipse CDT
  • Uses Google Test

Contents

Patterns Help You to Program Like an Expert 3
Where Do Patterns Come From? 4
What Is a Pattern? 5
What are Patterns? 6
What are Design Patterns? 7
Inside Volume One ← Click to Preview 8
Patterns-Happy 9
Hello World? ← Click to Preview 10
Composed Method 12
The Essence of Composed Method 13
Composition and Performance 14
Composed Method: The Players 15
The Importance of Storytelling 16
Guidelines For Creating Composed Methods 17
Composed Method Motivation 18
Composed Method Objections 19
Template Method 21
The Essence of Template Method ← Click to Preview 22
Template Method: An Example 23
How Mike the Scalper Scores Tickets 24
A Template Method for Scoring Tickets 25
Template Method Players ← Click to Preview 26
Putting Meat on the Bones 27
Hackers and Customers Quiz 28
Refactoring to a Template Method 29
Composed Methods vs. Template Methods 30
Template Method Exercise ← Click to Preview 32
Understanding the Domain 33
Dealing With A Special Case 34
Problem Source Code 35
Critiquing Your Performance 36
Installing the Recorder 37
Download, Build & Test Instructions 38
Upload Your Exercise 39
A Graph of Your Refactoring & Testing Activity 40
Your Critique Results 41
Your Customized Feedback 42
Solution 43
Creation Method 45
The Facts of Life 46
Constructor Intents 47
Constructor Shortcomings 48
The Stork 49
Creation Method Players ← Click to Preview 50
Constructors and Creation Methods 51
A Class With Too Many Constructors! ← Click to Preview 53
Why Not Subclass Loan? 54
A Closer Look At Loan 55
Refactoring Loan 56
Download & Build Instructions 57
How We Solved The Exercise 58
Factory Method 60
The Essence of Factory Method 61
Factory Method Players 62
Creation Methods and Factory Methods 63
Factory Method: Fact or Fiction? 64
Example Code 65
The Ministry Of Software ← Click to Preview 66
Factory Method: Portfolio Quiz 67
Factory Method: How to Tell 68
Factory Method: Coupling Quiz 69
Factory Method Exercise ← Click to Preview 71
Problem Source Code 72
Refactoring Guidance 73
Critiquing Your Performance 74
Installing the Recorder 75
Download, Build & Test Instructions 76
Upload Your Exercise 77
A Graph of Your Refactoring & Testing Activity 78
Your Critique Results 79
Your Customized Feedback 80
Solution 81
Abstract Factory 83
An Automotive Abstract Factory 84
Abstract Factory Players ← Click to Preview 85
What is a Factory? 86
Abstract Factory vs. Factory 87
Strategy 89
The Essence of the Strategy Pattern 90
Avoiding a Subclass Explosion 91
Strategy: The Players 92
Strategy: A Simple Problem 93
Collaboration and Encapsulation 94
Cooperation and Visibility 95
Passing Data as Parameters 96
Passing the Entire Context 97
Pluggable Guts 98
Starting Your Own Family 99
Strategy: A Question of Values 100
Strategy: Freedom from Choice 101
Strategy: Sharing Your Strategies 102
Strategy: Accommodating Variety 103
Strategy Exercise 105
Problem Source Code 106
Critiquing Your Performance 107
Installing the Recorder 108
Download, Build & Test Instructions 109
Upload Your Exercise 110
A Graph of Your Refactoring & Testing Activity 111
Your Critique Results 112
Your Customized Feedback 113
Solution 114
Mechanics Step 1: Create Strategy Class 115
Mechanics Step 2: Pass Data Or Context? 116
Mechanics Step 2.1: Premature Move Method 117
Mechanics Step 2.2: Encapsulate Fields 118
Mechanics Step 2.3: Move Capital Method 119
Mechanics Step 2.4: Move Via Inline & Extract 120
Mechanics Step 2.5: Move Duration 121
Mechanics Step 2.6: Replace Variable With Field 122
Mechanics Step 3.0: Extract Parameter 123
Mechanics Step 4: Replace Conditional With Polymorphism ← Click to Preview 124
Mechanics Step 4.1: Push Down Calculation Behavior 125
Prototype 127
The Essence of Prototype 128
Why Clone? 129
The Players 130
Prototype Factory Example 131
Deep Copy Example 132
Prototype Quiz 133
Loan Quiz 134
Singleton 136
The Essence of Singleton 137
The Players 138
Pattern Luminaries on Singleton 139
The Evils of Singleton 140
When Is Singleton A Mistake To Use? 141
An Extended Example 142
Singleton Quiz 143
Monostate 144
Singleton and Concurrency 145

Related Items