Composite is used when you have an object containing of a bunch of other objects. For example, an AWT Frame object can contain Panels, Buttons, and TextFields, to name just a few. Composite is also useful for querying groups of objects. For example you could collect Employee objects inside of Department objects that implemented the same interface. You could then query an employee for his salary, or a Department for the total salaries of all of its Employees.
Adapter Now let's introduce a new class into our system.
There could be a common base class, such as Waterfowl, but in our implementation there isn't. One of the advantages of a type-safe language is that it keeps you from accidentally using an object that doesn't implement the right interface, just as differently shape electrical plugs keep you from plugging your 110 volt shaver into a 220 volt outlet. But sometimes, you really do want to plug your 110 volt shaver into a 220 volt outlet, say when you are traveling in Europe where all outlets are 220 volts. In that case, you have to buy an adapter, which both converts the voltage, and makes the plug fit. A lot of patterns work well together.