Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
41 views

Head First Design Patterns: Observer Pattern

This document discusses the Observer design pattern which allows one object, called the subject, to notify multiple observer objects about any state changes to the subject. The subject maintains a list of observers and notifies them of any changes. This loose coupling between the subject and observers allows new observer types to be added over time without modifying the subject, and subjects and observers can be reused independently. An example is given of a weather data observer pattern where a weather data subject notifies observers of weather changes.

Uploaded by

Hanif Faqot
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Head First Design Patterns: Observer Pattern

This document discusses the Observer design pattern which allows one object, called the subject, to notify multiple observer objects about any state changes to the subject. The subject maintains a list of observers and notifies them of any changes. This loose coupling between the subject and observers allows new observer types to be added over time without modifying the subject, and subjects and observers can be reused independently. An example is given of a weather data observer pattern where a weather data subject notifies observers of weather changes.

Uploaded by

Hanif Faqot
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Head First Design Patterns

Observer Pattern

Observer Pattern Defined

Class Diagram Observer Pattern

Power of loose coupling

The only thing that the subject knows about an observer is that it
implements an interface
We can add new observers at any time
We never need to modify the subject too add new type of
observers
We can reuse subject or observers independently of each other
Change to either the subject or an observer will not affext the
other

Weather data observer pattern

Weather data interface

Implementing subject interface

You might also like