Like an example in the Mediator pattern chapter (Chapter 11), air traffic needs a centralized air traffic control. There are many operators sitting inside the air controller tower watching their radar screens to make sure no mid-air collision can occur. At the same time, pilots who are flying their multimillion-dollar big birds need to know what’s happening around them, i.e., the traffic in the air. Pilots can tune to specific channels on their radio and listen to (observe) the surrounding traffic. If a traffic controller broadcasts certain precautions and warnings to those pilots who are observing the channel, the pilots can acknowledge the messages with certain actions. So in this model, anyone can know what traffic control they are observing but not the other way around (at least the air traffic controller doesn’t know all observers but certain blips on the radar screen). Anyone (including real pilots) can tune in and out whenever they want without disturbing the others.
KeywordsClass Diagram Accessor Method Observer Pattern Code Snippet Radar Screen
Unable to display preview. Download preview PDF.