8
CSC4522: Réalisation & Déploiement (Design Patterns) TSP - 2016 1 Patron: Observer http://www-public.tem-tsp.eu/~gibson/Teaching/CSC4522/CSC4522-DesignPatterns-Observer.pdf http://www.glasbergen.com

Patron: Observer - Télécom SudParis(Design Patterns) TSP - 2016 8 The Observer Design Pattern: Mediatheque Problem In the mediatheque,we are adding a use case that can be added to

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Patron: Observer - Télécom SudParis(Design Patterns) TSP - 2016 8 The Observer Design Pattern: Mediatheque Problem In the mediatheque,we are adding a use case that can be added to

CSC4522: Réalisation & Déploiement (Design Patterns)

TSP - 2016 1

Patron: Observerhttp://www-public.tem-tsp.eu/~gibson/Teaching/CSC4522/CSC4522-DesignPatterns-Observer.pdf

http://www.glasbergen.com

Page 2: Patron: Observer - Télécom SudParis(Design Patterns) TSP - 2016 8 The Observer Design Pattern: Mediatheque Problem In the mediatheque,we are adding a use case that can be added to

CSC4522: Réalisation & Déploiement (Design Patterns)

TSP - 2016 2

Patron: Observateur https://fr.wikipedia.org/wiki/Observateur_(patron_de_conception)

Le patron de conception observateur est utilisé en programmation pour envoyer un signal à des modules qui jouent le rôle d'observateurs.

En cas de notification, les observateurs effectuent alors l'action adéquate en fonction des informations qui parviennent depuis les modules qu'ils observent (les « observables »).

Le principe est que chaque classe observable contient une liste d’observateurs. Ainsi à l'aide d'une méthode de notification l'ensemble des observateurs est prévenu.

Page 3: Patron: Observer - Télécom SudParis(Design Patterns) TSP - 2016 8 The Observer Design Pattern: Mediatheque Problem In the mediatheque,we are adding a use case that can be added to

CSC4522: Réalisation & Déploiement (Design Patterns)

TSP - 2016 3

The Observer Design Pattern: any potential for use in your project work?

Page 4: Patron: Observer - Télécom SudParis(Design Patterns) TSP - 2016 8 The Observer Design Pattern: Mediatheque Problem In the mediatheque,we are adding a use case that can be added to

CSC4522: Réalisation & Déploiement (Design Patterns)

TSP - 2016 4

The Observer Design Pattern: any potential for use in your project work?

Page 5: Patron: Observer - Télécom SudParis(Design Patterns) TSP - 2016 8 The Observer Design Pattern: Mediatheque Problem In the mediatheque,we are adding a use case that can be added to

CSC4522: Réalisation & Déploiement (Design Patterns)

TSP - 2016 5

The Observer Design Pattern UML class diagram

Adapted From: GOF book

Page 6: Patron: Observer - Télécom SudParis(Design Patterns) TSP - 2016 8 The Observer Design Pattern: Mediatheque Problem In the mediatheque,we are adding a use case that can be added to

CSC4522: Réalisation & Déploiement (Design Patterns)

TSP - 2016 6

The Observer Design Pattern UML sequence diagram

aConcreteSubject aConcreteObserver anotherConcreteObserver

From: GOF book

Page 7: Patron: Observer - Télécom SudParis(Design Patterns) TSP - 2016 8 The Observer Design Pattern: Mediatheque Problem In the mediatheque,we are adding a use case that can be added to

CSC4522: Réalisation & Déploiement (Design Patterns)

TSP - 2016 7

The Observer Design Pattern: Java implementation

Question: what are the differences between the 2 implementations? 1.designpatternobserver 2.designpatternobserverwithjavautils

Problem: Examine 2 different implementations of the observer pattern in Java

http://www-public.tem-tsp.eu/~gibson/Teaching/CSC4522/SourceCode/Observer.zip

(Import existing project into Eclipse)

Page 8: Patron: Observer - Télécom SudParis(Design Patterns) TSP - 2016 8 The Observer Design Pattern: Mediatheque Problem In the mediatheque,we are adding a use case that can be added to

CSC4522: Réalisation & Déploiement (Design Patterns)

TSP - 2016 8

The Observer Design Pattern: Mediatheque ProblemIn the mediatheque,we are adding a use case that can be added to the implementation through use of the observer pattern. Your task is to try to do this before next week’s session.