Facilitating Communication Between Objects
Learn which design patterns to use when multiple object instances of different types communicate.
Problem statement
Let’s imagine that we have a container object that contains other objects of various types. To make it clearer, imagine that the container object is the background of a user interface, while other objects, such as text boxes, buttons, labels, etc., are its components.
Certain objects need to emit certain events that should be able to affect other objects. For example, clicking a particular button should be able to change the text on specific labels.
The last thing we want to do in this situation is to connect the components directly to each other. If we do that, our code becomes excessively complex. It’s especially true when we have many elements ...