Introduction to Pattern Oriented Analysis and Design (POAD) hhammar/rts/adv rts/adv...
date post
25-May-2020Category
Documents
view
7download
0
Embed Size (px)
Transcript of Introduction to Pattern Oriented Analysis and Design (POAD) hhammar/rts/adv rts/adv...
Introduction to Pattern Oriented Analysis and Design (POAD)
Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU
Outline Review of Design Patterns
– The Lifecycle of a Pattern – Examples of Design Patterns
The Command Pattern The Observer Pattern The Strategy Pattern
Pattern Oriented Development – The Analysis phase – The Design phase – The design refinement phase
The Feedback Control Example
The Lifecycle of Patterns
Real World Projects
Pattern Mining
Discover Patterns
Incident Occurrence of a Pattern
Preliminary Documentati
on
Document Analyze/Rule of Three
Author Version
Document
Pattern Polishing
Reusable Version
Pattern Reuse
Feedback
Modification
Phase I: MINING
Author World
Phase II: POLISHING
Pattern Community World
Phase III: REUSE
Pattern User World
Legend
Activit y Produc t
(From the Reference “Pattern-Oriented Analysis and Design”, Sherif M Yacoub and Hany H. Ammar Addison-Wesley Inc., 2004)
Review of Design Patterns Examples of Design Patterns (From the Design
Patterns CD by Gamma et al, Addison-Wesley Inc., 1998 )
The Command Pattern: Encapsulate a request as an object
Review of Design Patterns
The Command Pattern
From the Design Patterns CD by Gamma et al, Addison-Wesley Inc., 1998
Review of Design Patterns Examples of Design Patterns The Observer Pattern: when one object changes state, all its dependents are notified and updated automatically
Model View Controller example
Review of Design Patterns
Examples of Design Patterns The Observer Pattern class diagram
From the Design Patterns CD by Gamma et al, Addison-Wesley Inc., 1998
Review of Design Patterns Examples of Design Patterns
The Strategy Pattern: lets the algorithm vary independently from clients that use it
Pattern Oriented Development
Design Patterns are used in an ad-hoc strategy for design refinement
They are also used to address a set of design problems without any guidance of how these patterns can be glued or interface together
Is there a way to use design patterns as building blocks or as components in the design of systems ?
Pattern Oriented Development
Pattern Oriented Analysis and Design (POAD)
The process aspects of POAD explains the phases and steps to develop an application design using patterns the POAD process has three phases:
– Analysis – Design – Design Refinement
Pattern Oriented Development
Analysis
Design
Design Refinement
a logical model is developed and patterns are selected
where patterns are glued together to produce a detailed pattern-level
diagram
An initial class diagram, and a more dense and profound class diagram,
and sequence diagrams are developed
Acquaintan ce Pattern
Library
Candidate Patterns
Selection
Selected Patterns
Application Requirements
Requirem ent
Analysis
Required Conceptual
Components
Retrieval
Pattern-Level Diagrams
Constructing Pattern-Level
models
Create Pattern
Instances
Define Pattern
Relationships
Construct Pattern-Level
Diagrams
Constructing models for Pattern-Level with
Interfaces
Pattern-Level with Interfaces Diagrams
Declare Pattern
Interfaces
Identify Relationships
between Pattern Interfaces
Constructing models for Detailed Pattern-Level
Detailed Pattern- Level Diagrams
Selected Patterns
(c) Design
Instantiating Pattern Internals
Domain Specific Detailed Pattern-Level Diagrams
Specializatio n
Concretizatio n
Develop Class Diagrams
Initial UML class diagram
Design Optimization
Reductio n
Merging & Grouping
Optimized class diagram
Detailed Pattern- Level Diagrams(d) Design Refinement
Analysis
Design
Design Refinement
(b) Analysis
(a) Overall POAD
The POAD process a) overall phases, b) analysis, c) design, and d) design refinement
POAD Analysis Phase
Develop use case diagrams to identify the problems to be solved and the possible breakdown of the application as a set of logical components.
Acquaintance with relevant pattern databases to get the analyst familiar with existing solutions.
Retrieval of patterns from the domain specific databases to select a set of candidate patterns in an automated fashion.
Selection of patterns from a set of candidate patterns for possible inclusion in the design process.
Construct Pattern-Level Models
Create an instance for each selected pattern by describing the patterns and their constituents in an application specific context
Define how these instances are related to each other
The semantic of a dependency relationship used between patterns has a "uses" meaning
The Feedback Control Example
Block diagram for a feedback control system
Reference Input
Measurement
Feedback Data
Error (Actuating)
Signal Feed forward Elements
Feedback Elements
Plant.+
+
Controlled Output
From Pattern-Oriented Analysis and Design, Sherif M Yacoub and Hany H. Ammar Addison-Wesley Inc., 2004
The Feedback Control Example POAD Analysis Phase (Pattern Selection)
– The feedforward component implements some sort of a control strategy (instance of Strategy pattern)
– The feedback component receives measurements and applies a feedback control strategy
– In the error calculation component, the feedback controller notifies the error calculation unit with the feedback data (instances of the Observer pattern)
– Data of different types need to be exchanged between the framework components (Measurement, Feedback Data, input data , and error data )
The Feedback Control Example
FeedforwardStrategy
FeedbackObserver
FeedbackStrategy
ErrorObserver
Blackboard
Apply forward control strategy
Manipluate Data
Plant
Apply feedback control strategy
Manipulate Data
Calculate Error
Manipluate Data
Pattern-Level diagram for feedback control system This is an architectural pattern based on the data flow architectural style
The Feedback Control Example
FeedforwardStrategy (from POAD1-Feedback)
FeedbackObserver
(from POAD1-Feedback)
FeedbackStrategy
(from POAD1-Feedback) ErrorObserver
(from POAD1-Feedback)
Blackboard
(from POAD1-Feedback)
Context
Update Notify Context
Update
Notify
setData getData
Pattern-Level with Interfaces
The Feedback Control Example
F e e d f o r w a r d S t r a t e g y ( f r o m P O A D 1 - F e e d b a c k )
< < S t r a t e g y> > F e e d b a c kO b s e r ve r
( f r o m P O A D 1 - F e e d b a c k)
< < O b s e r ve r > >
F e e d b a c kS t r a t e g y ( f r o m P O A D 1 - F e e d b a c k )
< < S t r a t e g y> >
E r r o rO b s e rv er ( f r o m P O A D 1 - F e e d b a c k)
< < O b s e r ve r > >
B l a c kb o a r d ( f r o m P O A D 1 - F e e d b a c k )
< < B l a c kb o a r d > >
C o n te x t
U p d a t e N o t i f y C o n t e x t
U p d a t e
N o t i f y
s e t D a t a
g e t D a t a
C o n c r e t e O b s e r v e r
o b s e r v e r S t a t e
U p d a t e ( )
C o n c r e t e S u b je c t
s u b je c t S t a t e
g e t S t a t e ( )
S ub je c t
A t t a c h ( ) D e t a c h ( ) N o t if y ( )
O b s e r v e r U p d a t e ( ) nn
S u b je c t
A t t a c h ( ) D e t a c h ( ) N o t if y ( )
O b se rv er U p d a t e ( )
C o n c r e t e O b s e r v e r o b s e r v e r S t a t e
U p d a t e ( )
C o n c r e t e S u b je c t s u b je c t S t a t e
g e t S t a t e ( )
nn
C o n c r e t e S t r a t e g y A
A lg o r it h m I n t e r f a c e ( )
C o n c r e t e S t r a t e g y B
A lg o r ith m I n te r f a c e ( )
C on t e xt
C o n t e x t I n t e r f a c e ( )
S t r a t e g y
A lg o r it h m I n t e r f a c e ( )
C o n t e x t
C o n t e x t I n t e r f a c e ( )
S t r a t e g y
A lg o r it h m I n t e r f a c e ( )
C on cr e t e S t ra t eg yB
A lg o r it h m I n t e r f a c e ( )
C on c r et e S t ra t eg y A
A lg o r ith m I n te r f a c e ( )
C o n c r e t e D a t a H o ld e r A C o n c r e t e D a t a H o ld e r B
B la c k b o a r d
s e t D a t a ( )