The major difference between link and association is that link is a physical or theoretical connection between the objects whereas association is a group of links with same structure and semantics. Associations are implemented in programming languages as a reference model in which one object is referenced from the another. While links cannot be referenced as these are not objects by itself, but rely on the objects.
The link and association are mostly used in UML designing which can be seen as the principle of software engineering. UML designing helps in understanding and minimizing the dependencies among various design elements.
Content: Link and Association
|Basis for comparison||Link||Association|
|Basic||A link can be defined as a theoretical and physical connection between objects.||An association is a specification of a collection of links.|
|Function||Relationship among objects.||Connects related classes.|
|UML design symbol||Line segment between objects.||Also uses line segment but it shows the connection between classes.|
Definition of Link
The logical or physical connection among objects is referred to as link. These links are used to relate multiple objects and represent a relationship between objects. We can not reference links, because a link is not a component of either object by its own but do rely on the objects.
The link can be explained by the example such as students studying in university or universities in which there would be several numbers of students studying in one or more than one universities which can be represented by the below-given diagram.
The links in the above example represent the relationship between the different objects. The links can be of three types – One-to-one, one-to-many, many-to-many.
Definition of Association
A collection of links is specified by an association which have common structure and semantics. Association is essentially bidirectional. As the class describes the potential objects, in the similar fashion an association represents a group of possible links.
The association among the alike classes is created by the collection of links among the objects. Let’s take an example, a student X studies at Z university. In the above example “studies in” is a link between student and university class. The various kinds of Association are unary, binary, ternary, quaternary, and higher order association.
Key Differences Between Link and Association
- The logical and physical connection between objects is known as links. On the other hand, a collection of links are specified by an association.
- The common function of a link is to describe the relationship between objects and connect them with each other. In contrast, an association is used to connect related classes.
- The UML symbol for link and association are same despite the fact that in the association there is the line segment that shows the relation between two or more classes. As against, in the link, the line segment shows the relationship between objects and group of objects.
Link and association are the ways to construct the relationship between objects and classes. Links corresponds to the objects while association has a relation with class.
Leave a Reply