Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UML - list of childs on parent vs. parent attribute on child

Tags:

uml

how can I tell from class diagrams if a 1-to-N relationship implies a point to the parent on each child or a list of childs on the parent? Or both?

For example. If there is a client and a client has orders, is there anyway to tell from the UML class diagram what of the following implementations would be the case?

class Client {
    array orders;
}

class Order {}

or

class Client {}
class Order { 
   client parent; 
}
like image 269
Rodrigo Stv Avatar asked Sep 23 '16 02:09

Rodrigo Stv


1 Answers

If the UML association is just a line, then you can't tell. But there are two ways to depict the difference in UML. The most common way is to show an arrowhead. This indicates what UML calls the 'navigability'. The class that owns the reference points to the referred class. The first alternative you mention would be depicted as follows:

arrow

The navigability arrow specifies that the Orders can be accessed efficiently from a Client, irrespective of how and why this is the case.

In recent versions of the UML specification, the dot notation has been introduced. The class that owns the reference has a dot on the opposite side of the association line (see UML 2.5 spec section 11.5.4). The first alternative you mention would be depicted as follows:

dot

The dot specifies that Client has a property which is a list/array of Orders. Because this is a relatively newly introduced notation, it is not widely used.

You may combine dot and arrow, but I would say that a dot implies navigability (not the other way around).

like image 152
www.admiraalit.nl Avatar answered Nov 09 '22 00:11

www.admiraalit.nl