Composite design pattern allows you to treat individual objects and compositions of objects uniformly. In this example, we created a tree-like structure.
In this example, the user interface displays the task hierarchy, and users can mark tasks as complete. The progress of the main task is calculated based on the completion status of its subtasks. The Composite design pattern is used to treat individual tasks and groups of tasks uniformly, making it easier to manage the task hierarchy and interact with the tasks.