Design Patterns Vol. 2

Producing Simpler Designs with Object Composition — C++ Edition

Art for Design Patterns Vol. 2 Check Out A Preview

By Joshua Kerievsky, Brian Foote

Our second volume of Design Patterns focuses on important variations on a classic object-oriented theme: how to best delegate or forward to cooperating objects, rather than using brute-force inheritance, to get things done. We explore a common theme in object-oriented design: favoring delegation over inheritance. The album draws from the Gang-of-Four's Structural and Behavioral patterns and uses them as a starting point.

Highlights

Instant Critiques
Instant Critiques: Take a refactoring exercise and get instant feedback from our automated band of experts. Learn more...
Delegation Patterns
Delegation Patterns: Learn a collection of patterns that produce better designs by favoring delegation over inheritance. 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

  • 4-6 hours of content
  • 122 pages of content
  • 4 Exercises
  • 10 Quizzes
  • 8 Patterns
  • 12 Videos
  • Platform-independent code
  • Support for Visual Studio
  • Support for Eclipse CDT
  • Uses Google Test

Contents

Inside Volume Two ← Click to Preview 3
The Duh Test 4
What's in a Name? 5
Composite 7
Essence of the Composite Pattern ← Click to Preview 8
The One/Many Distinction 9
Refactoring A One/Many Distinction 10
Composite Players 11
JUnit: A Classic Composite 12
XML: A Natural Composite 13
Know Your Composites 14
Builder 16
Why Do We Love Builders? 17
Complicated, Repetitive and Verbose Composite Construction 18
TagNode: What Needs Improvement? 19
Which TagBuilder Is Better? 20
Understanding TagBuilder 21
Building Different Products Using Identical Construction Steps 22
Builder: The Players 23
Decoupling Construction Logic With A Builder 24
Builder Quiz 25
Interpreter 27
Interpreter: The Essence 28
The Interpreter Pattern is Not About Parsing 29
Interpreter: The Players 30
Introduction ← Click to Preview 32
Search Expressions 33
Example Expression 34
Your Challenge 35
Problem Code 36
Critiquing Your Performance 37
Download and Setup Instructions 38
Upload Your Exercise 39
A Graph of Your Refactoring & Testing Activity 40
Your Critique Results 41
Your Customized Feedback 42
Solution 43
Lambda Solution 44
Expression Interpreter Problem 46
How to Construct Expressions 47
Test First 48
Extra Credit 49
Things to Test 50
Starter Code 51
Download and Setup Instructions 52
Expression Interpreter Solution 53
Pretty Printer Solution 54
Chain of Responsibility 56
Essence of the Chain of Responsibility 57
Tough Ticket 58
Mike to the Rescue 59
Meet Mike the Scalper ← Click to Preview 60
Mike's Supply Chain 61
The Buck Stops Here 62
The Players 63
What Could Go Wrong 64
Null Anchor Example 65
Null Object 67
Too Many Null Checks! 68
Null Object To The Rescue! 69
When Is A Null Object Unnecessary? 70
Null Object Players ← Click to Preview 71
Much Ado About Nothing 72
Bridge 74
Abstract Windowing Toolkit Example of Bridge 75
MFC Example of Bridge ← Click to Preview 76
Adapter 78
Adapter: The Essence 79
Adapter: The Players 80
Adapter Example 81
Two-Way Adapters 82
Adapter: The Quiz 83
In Need Of An Adapter ← Click to Preview 85
Choosing A Preferred Interface 86
Problem Source Code 87
Refactoring Guidance 88
Critiquing Your Performance 89
Download, Build & Test Instructions 90
Upload Your Exercise 91
A Graph of Your Refactoring & Testing Activity 92
Your Critique Results 93
Your Customized Feedback 94
Solution Video Step 1: Extract Interface ← Click to Preview 95
Solution Video Step 2: Extract Class 96
Solution Video Step 3: Move Method 97
Solution Video Step 4: Implement Interface 98
Solution Video Step 5: Pull Up Fields & Methods 99
Solution 100
Decorator 102
Bloated Objects 103
Avoiding Bloat 104
Decorator: The Players 105
How JUnit Avoided Featuritis 106
Patterns and Players Quiz 107
Proxy 109
Proxy: A Stand-In for Another Object 110
Proxy: The Players 111
Proxies Do Computational Chores 112
Chaining Proxies 113
Caching Proxy 114
Protection Proxy 115
A Problem to Solve 117
Problem Source Code 118
Refactoring Guidance 119
Download, Build & Test Instructions 120
Solution Source Code 121
Alternative Solution Source Code 122

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...
Delegation Patterns
Delegation Patterns: Learn a collection of patterns that produce better designs by favoring delegation over inheritance. 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

  • 4-6 hours of content
  • 122 pages of content
  • 4 Exercises
  • 10 Quizzes
  • 8 Patterns
  • 12 Videos
  • Platform-independent code
  • Support for Visual Studio
  • Support for Eclipse CDT
  • Uses Google Test

Contents

Inside Volume Two ← Click to Preview 3
The Duh Test 4
What's in a Name? 5
Composite 7
Essence of the Composite Pattern ← Click to Preview 8
The One/Many Distinction 9
Refactoring A One/Many Distinction 10
Composite Players 11
JUnit: A Classic Composite 12
XML: A Natural Composite 13
Know Your Composites 14
Builder 16
Why Do We Love Builders? 17
Complicated, Repetitive and Verbose Composite Construction 18
TagNode: What Needs Improvement? 19
Which TagBuilder Is Better? 20
Understanding TagBuilder 21
Building Different Products Using Identical Construction Steps 22
Builder: The Players 23
Decoupling Construction Logic With A Builder 24
Builder Quiz 25
Interpreter 27
Interpreter: The Essence 28
The Interpreter Pattern is Not About Parsing 29
Interpreter: The Players 30
Introduction ← Click to Preview 32
Search Expressions 33
Example Expression 34
Your Challenge 35
Problem Code 36
Critiquing Your Performance 37
Download and Setup Instructions 38
Upload Your Exercise 39
A Graph of Your Refactoring & Testing Activity 40
Your Critique Results 41
Your Customized Feedback 42
Solution 43
Lambda Solution 44
Expression Interpreter Problem 46
How to Construct Expressions 47
Test First 48
Extra Credit 49
Things to Test 50
Starter Code 51
Download and Setup Instructions 52
Expression Interpreter Solution 53
Pretty Printer Solution 54
Chain of Responsibility 56
Essence of the Chain of Responsibility 57
Tough Ticket 58
Mike to the Rescue 59
Meet Mike the Scalper ← Click to Preview 60
Mike's Supply Chain 61
The Buck Stops Here 62
The Players 63
What Could Go Wrong 64
Null Anchor Example 65
Null Object 67
Too Many Null Checks! 68
Null Object To The Rescue! 69
When Is A Null Object Unnecessary? 70
Null Object Players ← Click to Preview 71
Much Ado About Nothing 72
Bridge 74
Abstract Windowing Toolkit Example of Bridge 75
MFC Example of Bridge ← Click to Preview 76
Adapter 78
Adapter: The Essence 79
Adapter: The Players 80
Adapter Example 81
Two-Way Adapters 82
Adapter: The Quiz 83
In Need Of An Adapter ← Click to Preview 85
Choosing A Preferred Interface 86
Problem Source Code 87
Refactoring Guidance 88
Critiquing Your Performance 89
Download, Build & Test Instructions 90
Upload Your Exercise 91
A Graph of Your Refactoring & Testing Activity 92
Your Critique Results 93
Your Customized Feedback 94
Solution Video Step 1: Extract Interface ← Click to Preview 95
Solution Video Step 2: Extract Class 96
Solution Video Step 3: Move Method 97
Solution Video Step 4: Implement Interface 98
Solution Video Step 5: Pull Up Fields & Methods 99
Solution 100
Decorator 102
Bloated Objects 103
Avoiding Bloat 104
Decorator: The Players 105
How JUnit Avoided Featuritis 106
Patterns and Players Quiz 107
Proxy 109
Proxy: A Stand-In for Another Object 110
Proxy: The Players 111
Proxies Do Computational Chores 112
Chaining Proxies 113
Caching Proxy 114
Protection Proxy 115
A Problem to Solve 117
Problem Source Code 118
Refactoring Guidance 119
Download, Build & Test Instructions 120
Solution Source Code 121
Alternative Solution Source Code 122

Related Items