3

What is the differences between property owned by an association and a property owned by a class in UML?

is there a simple example helps me understand the differences?

2 Answers 2

0

The difference is more conceptual than anything else. If you have a property attached to an association, then you will have an association class, with the desired property.

Here is an example of a mailman sending letters to clients (the attribute weight is bound to the association):

enter image description here

4
  • Hi@Bastien! If you have a property attached to an association, then you will have an association classI think ,this sentence is not precise enough. As far as I know,when you associate two or more classes it is done thanks to two UML Properties. These latter are the ends of your association and are instance i.e. they are typed by their classes. So, an association is created between two classes on a class diagram but between each class and association you have a UML properties.Now,What is the differences between property owned by an association and a property owned by a class
    – Chriss
    Nov 25, 2013 at 7:37
  • Okay, I didn't understand your question properly. I got What is the difference between a class attribute and an attribute regarding the link between two classes. The difference between attributes in classes and those written on relations is the following: class attributes are not denoting any kind of association between objects in the diagram. They are only of types that do not appear in the diagram (integer, array, some class...). Attributes on edges will denote a relation between instances. In the UML above, an attribute sender of class Mailman will be generated in class Client. Nov 25, 2013 at 11:46
  • Does that mean if the property represented as associationEnd, it would be an instance of class. and if the property represented as attribute ,it would be an attribute of class? thanks dude @Bastien Pasdeloup :)
    – Chriss
    Nov 25, 2013 at 19:17
  • 1
    In fact, a property represented at the end of an edge will result as an instanciation of the class next to it, that will be an attribute of the class at the other side of the edge. For example, if you have A prop (1) --------------- B then you will have an attribute of type A in B. Therefore, every instance of B will have an attribute that is an object issued from class A. To sum it up, properties at the end of edges are attributes, but putting them here instead of inside the class to which they belong aims at showing the link between classes. Nov 25, 2013 at 20:14
0

The difference is very concrete, but traditionally ignored.

  • A is associated to B. A,B are classes.
  • If B end of the association is "association owned" and navigable, it means, that you can easily reach instance of B from A, either by reference, or by some method(s). It should be shown by arrow.
  • If B end is "classifier owned", you know a bit more. it means, that A has an attribute, that is a direct reference. (No functions or reference counting here). It should be shown by arrow and "dot"- a small black filled circle.

If you are going to B by a.smth.smthelse.b, it is arrow, but surely no dot.

If you are going to B by a.b, it is arrow and dot.

If you haven't decided yet, it is arrow again.

  • Traditionally modellers show arrows only. But it is not a good tradition, and is against UML standard. Diagrams are more useful if we decide as much as possible on them, not in code.

  • If both ends are navigable, both arrows disappear and you may see only dot(s).

  • The association lines with cross with dot on one side, or arrow on one side and only dot on the other are senseless.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.