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
  • 156 pages of content
  • 8 Patterns
  • 7 Videos
  • 5 Exercises
  • 19 Quizzes
  • Support for Visual Studio

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
Using ReSharper With the Exercises 38
Download, Build & Test Instructions 39
Upload Your Exercise 40
A Graph of Your Refactoring & Testing Activity 41
Your Critique Results 42
Your Customized Feedback 43
Solution 44
Creation Method 46
The Facts of Life 47
Constructor Intents 48
Constructor Shortcomings 49
The Stork 50
Creation Method Players ← Click to Preview 51
Constructors and Creation Methods 52
A Class With Too Many Constructors! ← Click to Preview 54
Why Not Subclass Loan? 55
A Closer Look At Loan 56
Refactoring Loan 57
Download & Build Instructions 58
How We Solved The Exercise 59
Factory Method 61
The Essence of Factory Method 62
Factory Method Players 63
Creation Methods and Factory Methods 64
Factory Method: Fact or Fiction? 65
Example Code 66
The Ministry Of Software ← Click to Preview 67
Factory Method: Portfolio Quiz 68
Factory Method: How to Tell 69
Factory Method: Coupling Quiz 70
Factory Method Exercise ← Click to Preview 72
Problem Source Code 73
Refactoring Guidance 74
Critiquing Your Performance 75
Installing the Recorder 76
Using ReSharper With the Exercises 77
Download, Build & Test Instructions 78
Upload Your Exercise 79
A Graph of Your Refactoring & Testing Activity 80
Your Critique Results 81
Your Customized Feedback 82
Solution 83
Abstract Factory 85
An Automotive Abstract Factory 86
Abstract Factory Players ← Click to Preview 87
What is a Factory? 88
Abstract Factory vs. Factory 89
Setting String Parsing Options In The HTML Parser 91
Problem Source Code 92
Solution Sprawl In StringNode Creation 93
Factory & Abstract Factory to the Rescue 94
Download, Build & Test Instructions 95
Solution 96
Strategy 98
The Essence of the Strategy Pattern 99
Avoiding a Subclass Explosion 100
Strategy: The Players 101
Strategy: A Simple Problem 102
Collaboration and Encapsulation 103
Cooperation and Visibility 104
Passing Data as Parameters 105
Passing the Entire Context 106
Internal Organs 107
Pluggable Guts 108
Starting Your Own Family 109
Strategy: A Question of Values 110
Strategy: Freedom from Choice 111
Strategy: Sharing Your Strategies 112
Strategy: Accommodating Variety 113
Strategy Exercise 115
Problem Source Code 116
Critiquing Your Performance 117
Installing the Recorder 118
Using ReSharper With the Exercises 119
Download, Build & Test Instructions 120
Upload Your Exercise 121
A Graph of Your Refactoring & Testing Activity 122
Your Critique Results 123
Your Customized Feedback 124
Solution 125
Mechanics Step 1: Create Strategy Class 126
Mechanics Step 2: Pass Data Or Context? 127
Mechanics Step 2.1: Premature Move Method 128
Mechanics Step 2.2: Encapsulate Fields 129
Mechanics Step 2.3: Move Capital Method 130
Mechanics Step 2.4: Move Via Inline & Extract 131
Mechanics Step 2.5: Move Duration 132
Mechanics Step 2.6: Replace Variable With Field 133
Mechanics Step 3.0: Extract Parameter 134
Mechanics Step 4: Replace Conditional With Polymorphism ← Click to Preview 135
Mechanics Step 4.1: Push Down Calculation Behavior 136
Prototype 138
The Essence of Prototype 139
Why Clone? 140
The Players 141
Prototype Factory Example 142
Deep Copy Example 143
Prototype Quiz 144
Loan Quiz 145
Singleton 147
The Essence of Singleton 148
The Players 149
Pattern Luminaries on Singleton 150
The Evils of Singleton 151
When Is Singleton A Mistake To Use? 152
An Extended Example 153
Singleton Quiz 154
Monostate 155
Singleton and Concurrency 156

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
  • 156 pages of content
  • 8 Patterns
  • 7 Videos
  • 5 Exercises
  • 19 Quizzes
  • Support for Visual Studio

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
Using ReSharper With the Exercises 38
Download, Build & Test Instructions 39
Upload Your Exercise 40
A Graph of Your Refactoring & Testing Activity 41
Your Critique Results 42
Your Customized Feedback 43
Solution 44
Creation Method 46
The Facts of Life 47
Constructor Intents 48
Constructor Shortcomings 49
The Stork 50
Creation Method Players ← Click to Preview 51
Constructors and Creation Methods 52
A Class With Too Many Constructors! ← Click to Preview 54
Why Not Subclass Loan? 55
A Closer Look At Loan 56
Refactoring Loan 57
Download & Build Instructions 58
How We Solved The Exercise 59
Factory Method 61
The Essence of Factory Method 62
Factory Method Players 63
Creation Methods and Factory Methods 64
Factory Method: Fact or Fiction? 65
Example Code 66
The Ministry Of Software ← Click to Preview 67
Factory Method: Portfolio Quiz 68
Factory Method: How to Tell 69
Factory Method: Coupling Quiz 70
Factory Method Exercise ← Click to Preview 72
Problem Source Code 73
Refactoring Guidance 74
Critiquing Your Performance 75
Installing the Recorder 76
Using ReSharper With the Exercises 77
Download, Build & Test Instructions 78
Upload Your Exercise 79
A Graph of Your Refactoring & Testing Activity 80
Your Critique Results 81
Your Customized Feedback 82
Solution 83
Abstract Factory 85
An Automotive Abstract Factory 86
Abstract Factory Players ← Click to Preview 87
What is a Factory? 88
Abstract Factory vs. Factory 89
Setting String Parsing Options In The HTML Parser 91
Problem Source Code 92
Solution Sprawl In StringNode Creation 93
Factory & Abstract Factory to the Rescue 94
Download, Build & Test Instructions 95
Solution 96
Strategy 98
The Essence of the Strategy Pattern 99
Avoiding a Subclass Explosion 100
Strategy: The Players 101
Strategy: A Simple Problem 102
Collaboration and Encapsulation 103
Cooperation and Visibility 104
Passing Data as Parameters 105
Passing the Entire Context 106
Internal Organs 107
Pluggable Guts 108
Starting Your Own Family 109
Strategy: A Question of Values 110
Strategy: Freedom from Choice 111
Strategy: Sharing Your Strategies 112
Strategy: Accommodating Variety 113
Strategy Exercise 115
Problem Source Code 116
Critiquing Your Performance 117
Installing the Recorder 118
Using ReSharper With the Exercises 119
Download, Build & Test Instructions 120
Upload Your Exercise 121
A Graph of Your Refactoring & Testing Activity 122
Your Critique Results 123
Your Customized Feedback 124
Solution 125
Mechanics Step 1: Create Strategy Class 126
Mechanics Step 2: Pass Data Or Context? 127
Mechanics Step 2.1: Premature Move Method 128
Mechanics Step 2.2: Encapsulate Fields 129
Mechanics Step 2.3: Move Capital Method 130
Mechanics Step 2.4: Move Via Inline & Extract 131
Mechanics Step 2.5: Move Duration 132
Mechanics Step 2.6: Replace Variable With Field 133
Mechanics Step 3.0: Extract Parameter 134
Mechanics Step 4: Replace Conditional With Polymorphism ← Click to Preview 135
Mechanics Step 4.1: Push Down Calculation Behavior 136
Prototype 138
The Essence of Prototype 139
Why Clone? 140
The Players 141
Prototype Factory Example 142
Deep Copy Example 143
Prototype Quiz 144
Loan Quiz 145
Singleton 147
The Essence of Singleton 148
The Players 149
Pattern Luminaries on Singleton 150
The Evils of Singleton 151
When Is Singleton A Mistake To Use? 152
An Extended Example 153
Singleton Quiz 154
Monostate 155
Singleton and Concurrency 156

Related Items