cpx
cpx

Reputation: 17577

Does association in UML associate objects or classes?

On Wikipedia, I'm reading that an association relationship is an instance level relationship so we are talking about the relationship between the objects of two classes.

When we actually draw a class diagram, why do we use association on the class elements or blocks rather than objects? And there are also class level relationships for which we again use class elements. Since we don't have any way to show if we are talking about objects or classes I find this confusing. For example: I've heard people saying "Associate these two classes" Doesn't that sound wrong?

Upvotes: 4

Views: 501

Answers (4)

Xaelis
Xaelis

Reputation: 1599

When you are making a class diagram you are defining types. Suppose you have a class User and a class Account, you use an association between User and Account to say: User instances can have link(s) with Account instances at runtime.

So, you use classes and associations at type level (class diagram) to define what can be possible at runtime (instance level).

Upvotes: 1

sfinnie
sfinnie

Reputation: 9960

Links are to Associations as Objects are to Classes.

A Class is an abstraction that describes many specific objects. Similarly, an Association is an abstraction that describes many links between objects.

So your statement

an association relationship is an instance level relationship

isn't strictly correct because it mixes the abstraction (Association Relationship) with the instances it represents.

hth.

Upvotes: 5

Red Beard
Red Beard

Reputation: 3506

In fact, when you associate two or more classes it is done thanks to two or more UML Properties. These latter are the "ends" of your associations and are "instance" i.e. they are typed by classe. So an association is created between two classes on a class diagram but between each classes and the association you have a UML property.

Hoping it sounds clear ...

Upvotes: 3

tehknox
tehknox

Reputation: 278

The object is actually the Class that has been created virtualy. So a class is the "static" version of an Object. So, when we speak of UML, we speak about classes and not object.

But correct me if I'm wrong!

Upvotes: 0

Related Questions