- Spring 5 Design Patterns
- Dinesh Rajput
- 121字
- 2021-07-08 09:59:38
Common problems solved by the composite pattern
As a developer, it is more difficult to design an application so that the client can access your objects uniformly across the application, even if that object was a composition of objects or an individual object. This design pattern resolves difficulties and allows you to design objects in such a way that you can use that object as a composition of objects and a single individual object.
This pattern solves the challenges faced when creating hierarchical tree structures to provide clients with a uniform way to access and manipulate objects in the tree. The composite pattern is a good choice; it is less complex in this situation to treat primitives and composites as homogeneous.