Design Patterns. What are design patterns? A general reusable solution to a commonly occurring...

13
Design Patterns Design Patterns
  • 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...

Page 1: 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.

Design PatternsDesign Patterns

Page 2: 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.

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.

Page 3: 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.

For example…For example…

Page 4: 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.

Gang of FourGang of Four

Page 5: 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.

Words to live byWords to live by

Program to an interface, not an implementation.

Favor object composition over class inheritance.

Interfaces: good

Inheritance: bad

Page 6: 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.

Types of design patternsTypes of design patterns

• Creational– Instantiation of objects

• Structural– Class and object composition

• Behavioral– Communication between objects

Page 7: 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.

Creational patternsCreational patterns

• Abstract Factory

• Builder

• Factory Method

• Prototype

• Singleton

Page 8: 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.

Creational patternsCreational patterns

• Abstract Factory

• Builder

• Factory Method

• Prototype

• Singleton

Page 9: 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.

Structural patternsStructural patterns

• Adapter

• Bridge

• Composite

• Decorator

• Façade

• Flyweight

• Proxy

Page 10: 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.

Structural patternsStructural patterns

• Adapter

• Bridge

• Composite

• Decorator

• Façade

• Flyweight

• Proxy

Page 11: 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.

Behavioral patternsBehavioral patterns

• Chain of responsibility• Command• Interpreter• Iterator• Mediator• Memento• Observer• State

• Strategy• Template method• Visitor

Page 12: 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.

Behavioral patternsBehavioral patterns

• Chain of responsibility• Command• Interpreter• Iterator• Mediator• Memento• Observer• State

• Strategy• Template method• Visitor

Page 13: 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.

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