Structural: Composite Method

-- by Vikram

This particular design pattern is quite straight-forward and also very easy to understand with a suitable example. You might have been using many software where you can right-click add child components to each component. A typical example can be a drawing tool, where each shape you draw you can insert more shapes inside it, when specific shape is selected they provide same common functionality like move, reshape fill colors, delete etc. This design pattern is used to compose objects into tree like (parent-child) structures to represent part-whole hierarchies, this allows clients to use each object in tree to be treated uniformly. 

Another good example could be nested menus, each item in a menu can again be a menu which has same functionality. So, the key is if it looks like a recursive pattern for linked objects that have same interface or functionality then you can use composite pattern to compose the part-whole hierarchy of your object. There can be leaf nodes with no more children but they should too be uniformly accessible.

If you have written a binary tree program using classes (objects) you have already used the composite pattern in some way where the number of children is limited to 2 only.

In code it would look like each object has as a list/array or objects of same type or objects that implement same interface at the least.