Design Patterns Vol. 1

Foundational Patterns for Software Programmers — Java 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
  • 154 pages of content
  • 8 Patterns
  • 7 Videos
  • 5 Exercises
  • 18 Quizzes
  • Support for Eclipse
  • Support for IntelliJ

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
To Override Or Not To Override? 31
Template Method Exercise ← Click to Preview 33
Understanding the Domain 34
Dealing With A Special Case 35
Problem Source Code 36
Critiquing Your Performance 37
Installing the Recorder 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: 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
Setting String Parsing Options In The HTML Parser 89
Problem Source Code 90
Solution Sprawl In StringNode Creation 91
Factory & Abstract Factory to the Rescue 92
Download, Build & Test Instructions 93
Solution 94
Strategy 96
The Essence of the Strategy Pattern 97
Avoiding a Subclass Explosion 98
Strategy: The Players 99
Strategy: A Simple Problem 100
Collaboration and Encapsulation 101
Cooperation and Visibility 102
Passing Data as Parameters 103
Passing the Entire Context 104
Internal Organs 105
Pluggable Guts 106
Starting Your Own Family 107
Strategy: A Question of Values 108
Strategy: Freedom from Choice 109
Strategy: Sharing Your Strategies 110
Strategy: Accommodating Variety 111
Strategy Exercise 113
Problem Source Code 114
Critiquing Your Performance 115
Installing the Recorder 116
Download, Build & Test Instructions 117
Upload Your Exercise 118
A Graph of Your Refactoring & Testing Activity 119
Your Critique Results 120
Your Customized Feedback 121
Solution 122
Mechanics Step 1: Create Strategy Class 123
Mechanics Step 2: Pass Data Or Context? 124
Mechanics Step 2.1: Premature Move Method 125
Mechanics Step 2.2: Encapsulate Fields 126
Mechanics Step 2.3: Move Capital Method 127
Mechanics Step 2.4: Move Via Inline & Extract 128
Mechanics Step 2.5: Move Duration 129
Mechanics Step 2.6: Replace Variable With Field 130
Mechanics Step 3.0: Extract Parameter 131
Mechanics Step 4: Replace Conditional With Polymorphism ← Click to Preview 132
Mechanics Step 4.1: Push Down Calculation Behavior 133
Prototype 135
The Essence of Prototype 136
Why Clone? 137
The Players 138
Prototype Factory Example 139
Deep Copy Example 140
Prototype Quiz 141
Loan Quiz 142
Singleton 144
The Essence of Singleton 145
The Players 146
Pattern Luminaries on Singleton 147
The Evils of Singleton 148
When Is Singleton A Mistake To Use? 149
An Extended Example 150
Singleton Quiz 151
Monostate 152
Singleton and Concurrency 153
Are Anonymous Class Instances Singletons? 154

Related Items

Get this Album

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
  • 154 pages of content
  • 8 Patterns
  • 7 Videos
  • 5 Exercises
  • 18 Quizzes
  • Support for Eclipse
  • Support for IntelliJ

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
To Override Or Not To Override? 31
Template Method Exercise ← Click to Preview 33
Understanding the Domain 34
Dealing With A Special Case 35
Problem Source Code 36
Critiquing Your Performance 37
Installing the Recorder 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: 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
Setting String Parsing Options In The HTML Parser 89
Problem Source Code 90
Solution Sprawl In StringNode Creation 91
Factory & Abstract Factory to the Rescue 92
Download, Build & Test Instructions 93
Solution 94
Strategy 96
The Essence of the Strategy Pattern 97
Avoiding a Subclass Explosion 98
Strategy: The Players 99
Strategy: A Simple Problem 100
Collaboration and Encapsulation 101
Cooperation and Visibility 102
Passing Data as Parameters 103
Passing the Entire Context 104
Internal Organs 105
Pluggable Guts 106
Starting Your Own Family 107
Strategy: A Question of Values 108
Strategy: Freedom from Choice 109
Strategy: Sharing Your Strategies 110
Strategy: Accommodating Variety 111
Strategy Exercise 113
Problem Source Code 114
Critiquing Your Performance 115
Installing the Recorder 116
Download, Build & Test Instructions 117
Upload Your Exercise 118
A Graph of Your Refactoring & Testing Activity 119
Your Critique Results 120
Your Customized Feedback 121
Solution 122
Mechanics Step 1: Create Strategy Class 123
Mechanics Step 2: Pass Data Or Context? 124
Mechanics Step 2.1: Premature Move Method 125
Mechanics Step 2.2: Encapsulate Fields 126
Mechanics Step 2.3: Move Capital Method 127
Mechanics Step 2.4: Move Via Inline & Extract 128
Mechanics Step 2.5: Move Duration 129
Mechanics Step 2.6: Replace Variable With Field 130
Mechanics Step 3.0: Extract Parameter 131
Mechanics Step 4: Replace Conditional With Polymorphism ← Click to Preview 132
Mechanics Step 4.1: Push Down Calculation Behavior 133
Prototype 135
The Essence of Prototype 136
Why Clone? 137
The Players 138
Prototype Factory Example 139
Deep Copy Example 140
Prototype Quiz 141
Loan Quiz 142
Singleton 144
The Essence of Singleton 145
The Players 146
Pattern Luminaries on Singleton 147
The Evils of Singleton 148
When Is Singleton A Mistake To Use? 149
An Extended Example 150
Singleton Quiz 151
Monostate 152
Singleton and Concurrency 153
Are Anonymous Class Instances Singletons? 154

Related Items