"Design Patterns in C++, Java, and MATLAB" outline.
Chapter 1 - Introduction
Chronology
What is a design pattern?
setup_class and use_class
Data structures used in the labs
DP data structures compared to C++, Java, and MATLAB
How to convert a value to a string
What code samples in this course leave out - housekeeping methods
What code samples in this course leave out - who invokes the destructors
Appendices
Chapter 2 - Object-Oriented Guidelines
Command/Query Separation
Never inherit from a concrete class
Low Coupling
High Cohesion
Separation of Concerns
Model
View
Controller
Model-View-Controller (MVC) - Classes
Model-View-Controller (MVC) - Objects
Advantages of MVC
Disadvantages of MVC
Separation of Interface from Implementation
The effects of change
Indirection
Transparency
Reification
Indirection
Do not abuse/confuse/misuse/overuse inheritance
Chapter 3 - What type are you?
How to ask "What type are you?"
How to ask "Are you an instance of subclass1 or any of its subclasses?"
How to ask "Are you an instance of subclass1 but not any of its subclasses?"
Chapter 4 - Clone
How to implement a copy constructor
Shallow Copy
Deep copy
How to implement a copy constructor
How to implement a copy constructor with inheritance
Problem
How to copy an object when you don't know its type - the wrong way # 1
How to copy an object when you don't know its type - the wrong way # 2
How to copy an object when you don't know its type - the wrong way # 3
How to copy an object when you don't know its type - the wrong way # 4
How to copy an object when you don't know its type - the right way
How to implement clone()
What is a covariant return type?
Why should I use covariant return types?
Who deletes the clone?
The Clone Pattern
Lab
Chapter 5 - Disable Copy/Assignment
Problem
Value Semantics versus Reference Semantics
How to prevent copying/assigning an instance of a class - the wrong way # 1
How to prevent copying/assigning an instance of a class - the wrong way # 2
How to prevent copying/assigning an instance of a class - the wrong way # 3
How to prevent copying/assigning an instance of a class - the right way
The Disable Copy/Assignment Pattern
Lab
Chapter 6 - Memento
Problem
How to backup an object without breaking its encapsulation - the wrong way # 1
How to backup an object without breaking its encapsulation - the wrong way # 2
How to backup an object without breaking its encapsulation - the wrong way # 3
How to backup an object without breaking its encapsulation - the right way
The Memento Pattern
Lab
Chapter 7 - Template Method
Problem
How to override an instance method - the wrong way # 1
How to override an instance method - the wrong way # 2
How to override an instance method - the wrong way # 3
How to override an instance method - the wrong way # 4
How to override an instance method - the wrong way # 5
How to override an instance method - the right way
The Template Method Pattern
Lab
Chapter 8 - Chain of Responsibility
Problem
How to handle an event - the wrong way # 1
How to handle an event - the right way
The Chain of Responsibility Pattern
Lab
Chapter 9 - Prototype
Problem
How to instantiate one subclass - the wrong way # 1
How to instantiate one subclass - the right way
A Prototype is an Indirection
How to pre-configure the prototype
The Prototype Pattern
Lab
Chapter 10 - Factory Method and Factory Class
Problem
Factory
How to instantiate one subclass - the right way
A Factory is an Indirection
The Factory Method Pattern
Lab
Chapter 11 - Abstract Factory (Class)
Problem
How to mix windows and widgets
How to add a widget to a window
How to mix windows and widgets - the wrong way # 1
How to mix windows and widgets - the wrong way # 2
How to mix windows and widgets - the wrong way # 3
How to mix windows and widgets - the wrong way # 4
How to mix windows and widgets - the wrong way # 5
How to mix windows and widgets - the right way
A Factory is an Indirection
The Abstract Factory (Class) Pattern
Lab
Chapter 12 - Flyweight
Problem
How to avoid making duplicate objects - the wrong way # 1
How to avoid making duplicate objects - the right way
A Factory is an Indirection
Notes
The Flyweight Pattern
Lab
Chapter 13 - Singleton
Problem
How to limit the number of instances of a class to either 0 or 1 - the wrong way # 1
How to limit the number of instances of a class to either 0 or 1 - the wrong way # 2
How to limit the number of instances of a class to either 0 or 1 - the wrong way # 3
How to limit the number of instances of a class to either 0 or 1 - the right way
How to mix singleton and inheritance
When is a Singleton not a Singleton?
How to destroy a Singleton
The Singleton Pattern
Lab
Chapter 14 - Mediator
Problem
How to have N*N coupling
How to have M*N coupling
How to reduce coupling
A Mediator is an Indirection
The Mediator Pattern
Lab
Chapter 15 - Proxy
Problem
The Wrong Way # 1
The Wrong Way # 2
A Proxy is an Indirection
Different clients see different implementations of the same interface
Notes
How to dynamically create the Proxy
The Proxy Pattern
Lab
Chapter 16 - Facade
Problem
Facade
A Facade is an Indirection
The Facade Pattern
Lab
Chapter 17 - Adapter
Problem
An Adapter is an Indirection
The Adapter Pattern
Lab
Chapter 18 - Iterator
Problem
How do you iterate through the elements of an array?
Notes
Reification
An Iterator is an Indirection
The Iterator Pattern
Lab
Chapter 19 - All of Me
Problem
Solution
The All of Me Pattern
Lab
Chapter 20 - Observer
Problem
The Observer Pattern
Lab
Chapter 21 - Strategy
Problem
The wrong way # 1
The wrong way # 2
Reification
How to change your Strategy at run-time
The Strategy Pattern
Lab
Chapter 22 - State
Problem
How to implement state-dependent behavior - the wrong way # 1
The bad news
How to implement state-dependent behavior - the wrong way # 2
Reification
Notes
How to change your State at run-time
How to implement state-dependent behavior - the right way
The State Pattern
Lab
Chapter 23 - Bridge
Problem
Arrays
Sparse and Dense Arrays
What won't work # 1
What won't work # 2
What won't work # 3
Separation of Concerns
Solution - Objects
Solution - Classes
How to create the handle
How to copy the handle
How to assign the handle
How to destroy the handle
How to make the handle transparent to the client
When and how to switch the body
How to hide the handle
The Bridge Pattern
Lab
Chapter 24 - Decorator
Problem
Skiers and runners
Skiers and runners and swimmers, oh my!
The Diamond of Death
Why is the Diamond of Death so bad?
The Diamond of Death - In the Literature
How to gain/lose behaviors dynamically - the wrong way # 1
How to gain/lose behaviors dynamically - the right way - objects
How an athlete with no skill can gain one skill
How an athlete with one skill can gain another skill
How to gain/lose behaviors dynamically - the right way - classes
Notes
The Decorator Pattern
Lab
Chapter 25 - Composite
Problem
Parts is parts
How to talk to a simple_part
How to talk to a compound_part
Notes
How to have recursive hierarchical data structures - the wrong way # 1
The bad news
The Right Way
Are all hierarchical data structures recursive?
The Composite Pattern
Lab
Chapter 26 - Builder
Problem
How to build different data structures from the same input stream
How to build a tree
How to build a list
Notes
Solution
The parser
The sentence_builder superclass
A list builder subclass
A tree builder subclass
The main function
The Builder Pattern
Lab
Chapter 27 - Interpreter
Problem
The cost of a part
The Interpreter Pattern
Lab
Chapter 28 - Visitor
Problem
Different game characters react to different weapons in different ways.
The Wrong Way
One way to discover the dynamic type of the receiver
Double Dispatch
The first dispatch
The second dispatch
Back to parts
How to extend 2x2 double dispatch to MxN double dispatch
Reification
The composite - Before
How to migrate code from the composite to the visitor
The composite - After
The visitor
The visitor superclass
The visitor subclass
How to get the cost of a part
Notes
Visitor is MxN double dispatch
The Visitor Pattern
Lab
Chapter 29 - Null Object
Problem
Reification
What does a subclass of part_visitor do when it visits a null_part?
How to eliminate null pointers in composites
The Null Object Pattern
Lab
Chapter 30 - Command
Problem
How a button can callback a function - the wrong way # 1
How a button can callback a function - the wrong way # 2
How a button can callback a function - the right way
Problem
Reification
Classes
The Command Pattern
Lab
Chapter 31 - Conclusion
Density
Incorrect Uses Of Inheritance - Adapter
Incorrect Uses Of Inheritance - Bridge
Incorrect Uses Of Inheritance - Composite
Incorrect Uses Of Inheritance - Decorator
Incorrect Uses Of Inheritance - Proxy
Incorrect Uses Of Inheritance - State
Incorrect Uses Of Inheritance - Strategy
Advantages
Disadvantages
Sorting Design Patterns: By Name
Sorting Design Patterns: By Intent
Sorting Design Patterns: By Purpose and Scope
Sorting Design Patterns: By Problems They Solve
Sorting Design Patterns: By What They Vary
Internet links
Books
Magazines
Mailing Lists
Conferences