Structural patterns
Structural patterns are patterns that describe how objects should relate to each other so that they can work together to achieve a common goal. They help lower our coupling by suggesting an easy and clear way to break down a problem into related parts. They also help us raise our cohesion by giving us a predefined way in which those components will fit together.
This is like a sports team defining specific roles for each person on the field, so that they can play together better as a team.
The composite pattern
The first structural pattern that we are going to look at is called the composite pattern. The concept of this pattern is that you have a single object that can be broken down into a collection of objects just like it. This is like the organization of many large companies. They have teams that are made up of smaller teams, which are then made up of even smaller teams. Each subteam is responsible for a small part and they come together to be responsible for a larger...