When To Use
Composite can be used when clients should ignore the difference between compositions of objects and individual objects. If programmers find that they are using multiple objects in the same way, and often have nearly identical code to handle each of them, then composite is a good choice; it is less complex in this situation to treat primitives and composites as homogeneous.
Read more about this topic: Composite Pattern
Famous quotes containing the words when and/or use:
“What I would like to give my daughter is freedom. And this is something that must be given by example, not by exhortation. Freedom is a loose leash, a license to be different from your mother and still be loved. . . . Freedom is . . . not insisting that your daughter share your limitations. Freedom also means letting your daughter reject you when she needs to and come back when she needs to. Freedom is unconditional love.”
—Erica Jong (20th century)
“... it is use, and use alone, which leads one of us, tolerably trained to recognize any criterion of grace or any sense of the fitness of things, to tolerate ... the styles of dress to which we are more or less conforming every day of our lives. Fifty years hence they will seem to us as uncultivated as the nose-rings of the Hottentot seem today.”
—Elizabeth Stuart Phelps (18441911)