What is the difference between aggregation and association in uml




















We can also create a class that has UML Association properties; it is called as an association class. The reflexive association is a subtype of association relationship in UML. In a reflexive association, the instances of the same class can be related to each other.

An instance of a class is also said to be an object. Reflexive association states that a link or a connection can be present within the objects of the same class. The fruit class has two instances, such as mango and apple.

Reflexive association states that a link between mango and apple can be present as they are instances of the same class, such as fruit. As the name suggests, the directed association is related to the direction of flow within association classes. In a directed association, the flow is directed. The association from one class to another class flows in a single direction only. A server can process the requests of a client.

This flow is unidirectional, that flows from server to client only. Hence a directed association relationship can be present within servers and clients of a system. It is not a standard UML Relationship , but it is still used in various applications. Composite aggregation is described as a binary association decorated with a filled black diamond at the aggregate whole end. The folder could contain many files, while each File has exactly one Folder parent. If a folder is deleted, all contained files are removed as well.

The terms are used for setting up a relationship between the objects and classes. The aggregation and association can be distinguished by the fact that if the relationship between the two objects is part-whole type, it is an aggregation. In contrast, if the linked objects can be considered as independent, then this is known as an association.

These concepts are very useful in class modelling, where an intuitive graphic representation of the system plays a major role while communicating with the customers. Basis for comparison Association Aggregation Basic Involves the relationship between two or more classifiers. Shows a whole and part relationship. Syntax Single line segment between the components. Hollow diamond adjacent to the assembly class. Advantage Inflexible Provides flexibility.

A simple association between two classes describes a structural relationship between them. Further, it signifies that both classes are associated with each other at the same level and holds equal importance.

It has a property called address. The address belongs to another class called Address. Thus, it is an aggregation. Association is a relationship between two objects.

It can define the multiplicity between objects. It denotes whether the objects have one to one, one to many, or many to many associations. For example, assume that there are two classes — A and B. If one object of A relates to one object of B, then it is one to one association.

But, if one object of A relates to multiple objects of B, then that relationship is one to many. Similarly, if multiple objects of A are related to multiple objects of B, then the relationship is many to many. Therefore, these relationships define the association between objects.



0コメント

  • 1000 / 1000