© Dmitri Nesteruk 2019
Dmitri NesterukDesign Patterns in .NEThttps://doi.org/10.1007/978-1-4842-4366-4_18

18. Mediator

Dmitri Nesteruk1 
(1)
St. Petersburg, c.St-Peterburg, Russia
 

A large proportion of the code we write has different components (classes) communicating with one another through direct references. However, there are situations when you don’t necessarily want objects to be aware of each other’s presence. Or perhaps you do want them to be aware of one another, but you still don’t want them to communicate through references, because as soon as you keep and hold a reference to something, you extend that object’s lifetime beyond what might originally be desired (unless it is a WeakReference, of course).

The Mediator is a mechanism for facilitating ...

Get Design Patterns in .NET: Reusable Approaches in C# and F# for Object-Oriented Software Design now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.