Download presentation
Presentation is loading. Please wait.
Published by효춘 순 Modified over 6 years ago
1
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2005 Instructor: Patrice Chalin
2
Agenda – Lecture 12a … 9/17/2018 SOEN 343, © P.Chalin,
3
Gang Of Four Gamma, Helm, Johnson, Vlissides
Some patterns covered in Larman, Chap. 23,… All patterns in XDE As documentation. As dynamic templates. Erich 9/17/2018 SOEN 343, © P.Chalin,
4
GoF Pattern Summary (& Relationhips)
[Picutre (c) GoF CD] 9/17/2018 SOEN 343, © P.Chalin,
5
GoF Pattern Classification
Behavioral Patterns Creational Patterns Structural Patterns 9/17/2018 SOEN 343, © P.Chalin,
6
GoF Behavioral Patterns
Chain of Responsibility Command Interpreter Iterator Mediator Memento Observer State Strategy Template Method Visitor 9/17/2018 SOEN 343, © P.Chalin,
7
GoF Creational Patterns
Abstract Factory Builder Factory Method (we saw Simple Factory) Prototype Singleton 9/17/2018 SOEN 343, © P.Chalin,
8
GoF Structural Patterns
Adapter Bridge Composite Decorator Facade Flyweight Proxy 9/17/2018 SOEN 343, © P.Chalin,
9
Facade 9/17/2018 SOEN 343, © P.Chalin,
10
Facade 9/17/2018 SOEN 343, © P.Chalin,
11
Singleton (Larman Section 23.4) XDE Patterns Singleton
- uniqueInstance : Singleton - attribute # Singleton( ) + getUniqueInstance ( ) : Singleton + getAttr( ) 9/17/2018 SOEN 343, © P.Chalin,
12
Strategy Context / problem: How to design for varying, but related, algorithms or policies? How to design for the ability to change (even dynamically) these algorithms or policies? Solution: Define each algorithm/policy/strategy in a separate class with a common interface 9/17/2018 SOEN 343, © P.Chalin,
13
Strategy 9/17/2018 SOEN 343, © P.Chalin,
14
How Do We Create a Strategy?
9/17/2018 SOEN 343, © P.Chalin,
15
Composite Larman 23.7 (but explanation intertwined with other pattern)
Context / problem: How to treat an aggregate structure of objects the same way as an atomic (non-aggregate) object? Solution: Define classes for composite and atomic objects that implement the same interface. 9/17/2018 SOEN 343, © P.Chalin,
16
Observer Pattern 9/17/2018 SOEN 343, © P.Chalin,
17
Observer How shall we have the display be updated?
Why not … have the Sale inform the display when it changes value. 9/17/2018 SOEN 343, © P.Chalin,
18
What is Wrong With This? 9/17/2018 SOEN 343, © P.Chalin,
19
Observer Pattern Context / Problem: Different kinds of subscriber objects are interested in the state changes or events of a publisher object, and want to react in their own way when the publisher generates the event. … 9/17/2018 SOEN 343, © P.Chalin,
20
Observer Pattern Solution: Define a “subscriber” or “listener” interface. Subscribers implement this interface. The publisher can dynamically register subscribers who are interested in an event, and notify them when an event occurs. Clarification: Publisher can dynamically process registration requests from subscribers. 9/17/2018 SOEN 343, © P.Chalin,
21
Observers: Illustration
Change requests go down – e.g. one cell in the spread sheet might be changed. Notifications go up (upward dependencies are not ok) 9/17/2018 SOEN 343, © P.Chalin,
22
Observer Class Diagram
(Shown in class) 9/17/2018 SOEN 343, © P.Chalin,
23
Sale Example 9/17/2018 SOEN 343, © P.Chalin,
24
Observer Pattern (GoF book)
9/17/2018 SOEN 343, © P.Chalin,
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.