When should I use composite design pattern? -


I have not understood when I should use the overall design pattern for this design What kind of benefits will I get from the pattern? I visited but it only tells me about the structure of the design pattern and not the scenario in which it is used. I hope this will be beneficial for programmers like me who are starting to learn design patterns.

quote

when using composite pattern

  • You want to represent the complete hierarchy of objects.
  • You want customers to be able to ignore the differences between the objects and the compositions of individual objects in a uniform way.

    A common use is used as an inspirational example in the book, in which the graphic window's display system may include other windows and graphic elements such as images, Text composite can be made in run-time, and client code can manipulate all the elements without worry, because this type is for normal tasks like drawing.

Comments