Introduction
I’ve previously written about Mediator pattern and how it encapsulates object’s interaction and communication. This pattern promotes loose coupling between software components. It acts as a communication hub and it facilitates one-to-many, many-to-one and many-to-many communications.
We than saw an example of Vehicles Control Center where vehicles position is communicated to control center. We implemented a basic mechanism where many vehicles were broadcasting to control center. You can check this post for the details.
Today, we will build upon those learning and see couple of more examples to solidify our understanding.
Chat Room Use Case
This is a very common example and there are many different techniques to build this solution. However, for our demo purposes, I dumbed down the requirements and solution to keep focus on mediator and object’s communication.
In this use case, we have different teams/groups of persons and they need to communicate with each other.
Following diagram shows the relationship b/w entities and how different entities interact with each other.
Subscribe to continue reading
Subscribe to get access to the rest of this post and other subscriber-only content.