mursaleen fayyaz

mursaleen fayyaz

  • NA
  • 84
  • 125.1k

Where we can apply composite pattern in real life ?

Jul 29 2013 10:16 AM
Hi people,

I am sharing one real example, and expecting one example from your side.

First we see what is the definition of Composite Pattern ?

"Compose objects into tree structures to represent part-whole hierarchies. Composite lets the clients treat individual objects and composition of objects individually."

Leaves and branches of tree treated as Same. (No distinction)

Real Example:
Suppose you are an HR office in a company, and you send the same email notice to different people in a company.
If you are write email address of individuals in "To" box. I will recommend you to apply composite pattern for it. Make it sample and create Group of individuals.

Thanks,
Mursaleen Fayyaz
Jr.Software Engineer.