So let's try to summarize what we've learned about the mediator Design Patterns so essentially to get
the mediator working for you.
You know first of all create a mediator and then you have each of the objects in the system refer to
the mediator.
So typically you would refer to it in a field and perhaps use something like constructor injection to
make sure that the mediator is actually available in every single component.
And yes quite typically a mediator is a singleton as well because you don't really need more than one.
Now the mediator then engages in bidirectional communication with all of its connected components or
on the one hand every single component can actually have functions calling on the mediator.
So the mediator has functions that a component can take and call.
So for example that component can say can we please broadcast the following message but on the other
hand the components themselves have the functions which the mediator can call and they can sort of enlist
themselves in the process of being notified about something happening.
And typically we use event processing mechanisms such as reactive extensions and these make the communication
between the different components a lot easier to implement.