Stephenson College DP 98 1 Design Patterns by Derek Peacock

Preview:

Citation preview

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

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)

Stephenson College DP 98 4

Design Patterns

Creational Creating objects

Structural composition of objects

Behavioural Interaction between objects

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

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

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