Design Patterns. What are design patterns? A general reusable solution to a commonly occurring...
-
date post
21-Dec-2015 -
Category
Documents
-
view
218 -
download
1
Transcript of Design Patterns. What are design patterns? A general reusable solution to a commonly occurring...
Design PatternsDesign Patterns
What are design patterns?What are design patterns?
A general reusable solution to a commonly occurring problem.
A description or template for how to solve a problem that can be used in many different situations.
For example…For example…
Gang of FourGang of Four
Words to live byWords to live by
Program to an interface, not an implementation.
Favor object composition over class inheritance.
Interfaces: good
Inheritance: bad
Types of design patternsTypes of design patterns
• Creational– Instantiation of objects
• Structural– Class and object composition
• Behavioral– Communication between objects
Creational patternsCreational patterns
• Abstract Factory
• Builder
• Factory Method
• Prototype
• Singleton
Creational patternsCreational patterns
• Abstract Factory
• Builder
• Factory Method
• Prototype
• Singleton
Structural patternsStructural patterns
• Adapter
• Bridge
• Composite
• Decorator
• Façade
• Flyweight
• Proxy
Structural patternsStructural patterns
• Adapter
• Bridge
• Composite
• Decorator
• Façade
• Flyweight
• Proxy
Behavioral patternsBehavioral patterns
• Chain of responsibility• Command• Interpreter• Iterator• Mediator• Memento• Observer• State
• Strategy• Template method• Visitor
Behavioral patternsBehavioral patterns
• Chain of responsibility• Command• Interpreter• Iterator• Mediator• Memento• Observer• State
• Strategy• Template method• Visitor
And this affects me how?And this affects me how?
• What are design patterns used for?
• What are the three categories of GoF design patterns?
• Patterns you should be able to describe– Singleton– Composite– Façade– Chain-of-responsibility– Observer