design patterns. what are design patterns? a general reusable solution to a commonly occurring...

Post on 21-Dec-2015

218 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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

top related