Composition vs Aggregation

In UML terms, The role can have one of three types:

1. Association

2. Composition

3. Aggregation.

Associations indicate that the two classes have a relationship as discussed above. Composition and aggregation indicate something more about the relationship:

Composition (Call By Value ) indicates that one class belongs to the other. It’s strong Aggregation ( represented by Blackend Diamond in UML) Whole is responsible for the parts Creation and Destruction . A polygon is made up of several points. If the polygon is destroyed, so are the points. A Owner has a house ; ( Aggregation ) ; A house has a chair ( Aggregation ) ; A house has Wall , Roof , Floor ( Composition ) ; A chair can exist independent of House ; When a house is destroyed Wall, Roof anf Floor will be destroyed,

Aggregation (Call by Reference ) is similar to composition, but is a less rigorous way of grouping things. It’s week Whole-Part Relationship ; ( Represented by Hallow Diamond in UML) ( Call By Reference ) An order is made up of several products, but a product continues to exist even if the order is destroyed.

Both aggregation and composition are special kinds of associations. Aggregation is used to represent ownership or a whole/part relationship, and composition is used to represent an even stronger form of ownership. With composition, we get coincident lifetime of part with the whole. The composite object has sole responsibility for the disposition of its parts in terms of creation and destruction. In implementation terms, the composite is responsible for memory allocation and deallocation.

Moreover, the multiplicity of the aggregate end may not exceed one; i.e., it is unshared. An object may be part of only one composite at a time. If the composite is destroyed, it must either destroy all its parts or else give responsibility for them to some other object. A composite object can be designed with the knowledge that no other object will destroy its parts.

Composition can be used to model by-value aggregation, which is semantically equivalent to an attribute. In fact, composition was originally called aggregation-by-value in an earlier UML draft, with “normal” aggregation being thought of as aggregation-by-reference. The definitions have changed slightly, but the general ideas still apply.
The distinction between aggregation and composition is more of a design concept and is not usually relevant during analysis.

Finally, a word of warning on terminology:
While UML uses the terms association, aggregation, and composition with specific meanings, some object-oriented authors use one or more of these terms with slightly different interpretations. For example, it is fairly common to see all three UML relationships grouped under a single term, say composition, and then to discuss object-oriented relationships as being either inheritance (generalization) or composition.