stephenson college dp 98 1 design patterns by derek peacock

7
Stephenson College DP 98 1 Design Patterns by Derek Peacock

Upload: scot-sims

Post on 18-Jan-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Stephenson College DP 98 1 Design Patterns by Derek Peacock

Stephenson College DP 98 1

Design Patterns

by Derek Peacock

Page 2: Stephenson College DP 98 1 Design Patterns by Derek Peacock

Stephenson College DP 98 2

Introduction

Designing OO software is hard Specific enough for current problem General enough for future requirements Experts reuse past design solutions Patterns of classes to solve specific design

problems

Page 3: Stephenson College DP 98 1 Design Patterns by Derek Peacock

Stephenson College DP 98 3

What is a Pattern

A Pattern NameName A ProblemProblem (When to apply the pattern) The SolutionSolution (How to solve the problem)ConsequencesConsequences (Space, time, flexibility,

portability, extensibility)

Page 4: Stephenson College DP 98 1 Design Patterns by Derek Peacock

Stephenson College DP 98 4

Design Patterns

Creational Creating objects

Structural composition of objects

Behavioural Interaction between objects

Page 5: Stephenson College DP 98 1 Design Patterns by Derek Peacock

Stephenson College DP 98 5

Creational Patterns

Abstract Factory

Builder

Singleton

Interface for creating families of related objects

Create complex object from representation

Create a only one globally accessible object

Page 6: Stephenson College DP 98 1 Design Patterns by Derek Peacock

Stephenson College DP 98 6

Structural Patterns

Composite Decorator Façade Proxy

Part-whole hierarchies Attach additional responsibilities Unified interface to subsystems Provide surrogate for object

Page 7: Stephenson College DP 98 1 Design Patterns by Derek Peacock

Stephenson College DP 98 7

Behavioural Patterns

Chain Interpreter

Iterator Memento

Provide a message chain Interpret a language with

grammar Provide access to elements Capture objects internal states