Design Patterns: An Introduction, Exercises of Object Oriented Analysis and Design

introduction to Object oriented analysis and design

Typology: Exercises

2016/2017

Uploaded on 11/21/2017

ashim-sth
ashim-sth 🇳🇵

3 documents

1 / 90

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
An Introduction to Design Patterns
Douglas C. Schmidt
Vanderbilt University
www.dre.vanderbilt.edu/~schmidt/gof.ppt
Based on material produced by John Vlissides
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a

Partial preview of the text

Download Design Patterns: An Introduction and more Exercises Object Oriented Analysis and Design in PDF only on Docsity!

1

An Introduction to Design Patterns

Douglas C. Schmidt

Vanderbilt University

www.dre.vanderbilt.edu/~schmidt/gof.ppt

[email protected]

Based on material produced by John Vlissides

Overview

Part I: Motivation & Concept

 the issue

 what design patterns are

 what they’re good for

 how we develop & categorize them

4

Part I: Motivation & Concept

OOD methods emphasize design notations

Fine for specification, documentation

But OOD is more than just drawing diagrams

Good draftsmen  good designers

Good OO designers rely on lots of experience

At least as important as syntax

Most powerful reuse is design reuse Match problem to design experience

Part I: Motivation & Concept (cont’d)

Recurring Design Structures

OO systems exhibit recurring structures that

promote

 abstraction  flexibility  modularity  elegance

Therein lies valuable design knowledge

Problem:

capturing, communicating, & applying this

knowledge

Part I: Motivation & Concept (cont’d)

Four Basic Parts

1. Name
2. Problem (including “forces”)
3. Solution
4. Consequences & trade-offs of application

Language- & implementation-independent A “micro-architecture” Adjunct to existing methodologies (RUP, Fusion, SCRUM, etc.)

Part I: Motivation & Concept (cont’d)

Example: OBSERVER

Part I: Motivation & Concept (cont’d)

Design Space for GoF Patterns

Scope : domain over which a pattern applies Purpose : reflects what a pattern does

Part I: Motivation & Concept (cont’d)

Design Pattern Template (1st half)

NAME scope purpose

Intent short description of the pattern & its purpose Also Known As Any aliases this pattern is known by Motivation motivating scenario demonstrating pattern’s use Applicability circumstances in which pattern applies Structure graphical representation of the pattern using modified UML notation Participants participating classes and/or objects & their responsibilities

Part I: Motivation & Concept (cont’d)

Modified UML/OMT Notation

Motivation & Concept (cont’d)

OBSERVER object behavioral

Intent

define a one-to-many dependency between objects so that when one object changes state, all dependents are notified & updated

Applicability

 an abstraction has two aspects, one dependent on the other  a change to one object requires changing untold others  an object should notify unknown other objects

Structure

16

Motivation & Concept (cont’d)

OBSERVER (cont’d) object behavioral

Consequences

  • modularity: subject & observers may vary independently
  • extensibility: can define & add any number of observers
  • customizability: different observers offer different views of subject
  • unexpected updates: observers don’t know about each other
  • update overhead: might need hints or filtering

Implementation  subject-observer mapping  dangling references  update protocols: the push & pull models  registering modifications of interest explicitly

Known Uses  Smalltalk Model-View-Controller (MVC)  InterViews (Subjects & Views, Observer/Observable)  Andrew (Data Objects & Views)  Pub/sub middleware (e.g., CORBA Notification Service, Java Messaging Service)  Mailing lists

Part I: Motivation & Concept (cont’d)

Benefits of Patterns

  • Design reuse
  • Uniform design vocabulary
  • Enhance understanding, restructuring, &

team communication

  • Basis for automation
  • Transcends language-centric biases/myopia
  • Abstracts away from many unimportant

details

19

Part II: Application: Document

Editor (Lexi)

  1. Document structure
  2. Formatting
  3. Embellishment
  4. Multiple look & feels
  5. Multiple window systems
  6. User operations
  7. Spelling checking & hyphenation

7 Design Problems

Note that none of these patterns are restricted to document editors…

Document Structure

Goals:

 present document’s visual aspects  drawing, hit detection, alignment  support physical structure (e.g., lines, columns)

Constraints/forces:

 treat text & graphics uniformly  no distinction between one & many