Is association in UML related to objects or classes?

On Wikipedia, I read that a relationship relation is an instance level relationship, so we are talking about the relationship between objects of two classes.

When we actually draw a class diagram, why do we use association over class elements or blocks rather than objects? And there are also class level relationships for which we again use class elements. Since we have no way to show if we are talking about objects or classes, I find this confusing. For example: I heard people say, โ€œLink these two classes.โ€ Does this sound wrong?

+4
source share
4 answers

Links correspond to Associations , since Objects correspond to Classes .

A class is an abstraction that describes many specific objects. Similarly, an association is an abstraction that describes many relationships between objects.

So your statement

association relation is an instance level relation

is not strictly correct because it mixes abstraction (associative relation) with the instances that it represents.

NTN.

+5
source

In fact, when you bind two or more classes, this is done thanks to two or more UML properties. These latter are the "ends" of your associations and are the "instances", that is, they are typed by the class. Thus, an association is created between two classes in the class diagram, but between each class and association you have a UML property.

Hope this will be clear ...

+3
source

When you create a class diagram, you define types. Suppose you have a User class and a class account, you use the relationship between the user and the account to say: user instances can have links to instance instances at runtime.

So, you use classes and associations at the level level (class diagram) to determine what might be possible at run time (instance level).

+1
source

An object is actually a class that was created virtual. Thus, the class is a โ€œstaticโ€ version of the object. So, when we talk about UML, we are talking about classes, not about an object.

But correct me if I am wrong!

0
source

Source: https://habr.com/ru/post/1493107/


All Articles