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:
“I have a talent for silence and brevity. I can keep silent when it seems best to do so, and when I speak I can, and do usually, quit when I am done. This talent, or these two talents, I have cultivated. Silence and concise, brief speaking have got me some laurels, and, I suspect, lost me some. No odds. Do what is natural to you, and you are sure to get all the recognition you are entitled to.”
—Rutherford Birchard Hayes (18221893)
“... 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)