aggregation in uml notation
In UML models, an aggregation relationship shows a classifier as a part of or subordinate to another classifier. An aggregation is a special type of association in which objects are assembled or configured together to create a more complex object. ... Aggregations are closely related to compositions.
An aggregation is a subtype of an association relationship in UML. Aggregation and composition are both the types of association relationships in UML. An aggregation relationship can be described in simple words as " an object of one class can own or access the objects of another class."
In an aggregation relationship, the dependent object remains in the scope of a relationship even when the source object is destroyed.
Let us consider an example of a car and a wheel. A car needs a wheel to function correctly, but a wheel doesn't always need a car. It can also be used with the bike, bicycle, or any other vehicle but not a particular car. Here, the wheel object is meaningful even without the car object. Such a type of relationship is called an aggregation relation.
Summary:
Relationship in UML allows one thing to relate with other things inside the system.An association, dependency, generalization, and realization relationships are defined by UML. Composition relationship can also be used to represent that object can be a part of only one composite at a time. Association is used to describe that one object can be associated with another object. Dependency denotes that objects can be dependent on each other. A realization is a meaningful relationship between classifiers. Generalization is also called a parent-child relationship.
What is aggregation and composition in UML?
Aggregation implies a relationship where the child can exist independently of the parent. Example: Class (parent) and Student (child). Delete the Class and the Students still exist. Composition implies a relationship where the child cannot exist independent of the parent. Example: House (parent) and Room (child).
How do you represent aggregation in UML notation?
The aggregation relationship is represented by a straight line with an empty diamond at one end. The composition relationship is represented by a straight line with a black diamond at one end. In UML, it can exist between two or more classes.
No comments:
Post a Comment