composite pattern

royjayd
royjayd used Ask the Experts™
on
hi
Can someone give me a simple example of composite pattern in laymans terms and why we shuold be using it.

thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Check out this site. It has alot of information on composite patterns.
http://en.wikipedia.org/wiki/Composite_pattern 

Author

Commented:
no pointing to websites please. i want something in laymans terms with a very simple example.
Java Developer
Top Expert 2010
Commented:
Use the Composite pattern when you want to deal with a single object the same way you deal with multiple objects
for example think of a Shape, could be a circle, or a square, or it could be (composed of) a collection of shapes. The Composite pattern lets you deal with a collection of shapes the same way you deal with an individual shape

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial