From the course: Programming Foundations: Design Patterns

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: The Observer pattern

Challenge: The Observer pattern

From the course: Programming Foundations: Design Patterns

Start my 1-month free trial

Challenge: The Observer pattern

(high energy music) - [Narrator] The observer pattern can be used to loosely couple objects together. Whenever you have objects that want to be notified when another object is updated. In this challenge, you'll design a weather station and various classes that are interested in the weather station's data. Including a user interface, a logger, and an alert system. The weather station has a set of sensors that are used to measure temperature, wind speed, and pressure. The user interface, logger, and alert system are all interested in the data, and want to be notified when the weather station gets new data from the sensors. Make sure your design allows for other observers to easily be added to the design. For instance, you might want your business to get notified by the weather station too, and you don't want to have to change the code in the weather station.

Contents