130 likes | 255 Views
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…. Gang of Four. Words to live by.
E N D
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.
Words to live by Program to an interface, not an implementation. Favor object composition over class inheritance. Interfaces: good Inheritance: bad
Types of design patterns • Creational • Instantiation of objects • Structural • Class and object composition • Behavioral • Communication between objects
Creational patterns • Abstract Factory • Builder • Factory Method • Prototype • Singleton
Creational patterns • Abstract Factory • Builder • Factory Method • Prototype • Singleton
Structural patterns • Adapter • Bridge • Composite • Decorator • Façade • Flyweight • Proxy
Structural patterns • Adapter • Bridge • Composite • Decorator • Façade • Flyweight • Proxy
Chain of responsibility Command Interpreter Iterator Mediator Memento Observer State Strategy Template method Visitor Behavioral patterns
Chain of responsibility Command Interpreter Iterator Mediator Memento Observer State Strategy Template method Visitor Behavioral patterns
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