Направление стрелки ассоциации в диаграммах классов UML

На этой веб-странице, которая показывает, как нарисовать диаграмму классов, почему стрелка для ассоциации указывающий от порядка до клиента, а не от клиента для упорядочивания?

Учебное руководство UML - диаграммы классов

12
задан neuromancer 15 December 2009 в 10:13
поделиться

6 ответов

Association ends have a boolean navigability property in UML. In this case, the navigability in the direction order to customer is set to true while the navigation in the direction customer to order is set to false.

With this, the designer of the model expresses that orders now who is the customer associated with the order but customers do not have direct access to their orders.

If we look at the Java code for this model, navigability it is easier to understand. For this example, this navigability means that Order has an attribute of type Customer but Customer has no collection attribute to store his/her orders

0
ответ дан 2 December 2019 в 04:43
поделиться

The arrows describe the ways you can navigate. So in this diagram you can go from order to customer. And for the other way: no arrow means NOT "not navigable", but "no comment". There is no definite right way to do it.

6
ответ дан 2 December 2019 в 04:43
поделиться

Its because an order "has a" reference to a customer.

In a database, this would be a foreign key in the order-table, which stores the customer-id.

In code, you would store a reference to the associated customer object in an order object. So the order is pointing to the customer and not vice-versa.

7
ответ дан 2 December 2019 в 04:43
поделиться

Possibly because an order is associated with a customer? These kind of things can be seen as working either way, or sometimes both.

-1
ответ дан 2 December 2019 в 04:43
поделиться

It's a dependency, which is a special weak type of association. It means that for an order to exist, there must exist a customer at some point in time. There may be some point in the lifecycle of "order" where this requirement is not enforced.

-2
ответ дан 2 December 2019 в 04:43
поделиться

Это может помочь:

UML Class Diagrams: Руководящие принципы: http://msdn.microsoft.com/en-us/library/dd409416%28VS.100%29.aspx

Properties of an Association

Is Navigable: Если верно только для одной роли, появляется стрелка в направлении навигации. Ассоциация ассоциация может быть прочитана в этом направлении. Вы можете использовать этот параметр для указания навигации ссылок и отношений базы данных в программе.

Свойства ассоциаций в диаграммах классов UML: http://msdn.microsoft.com/en-us/library/dd323862%28VS.100%29.aspx

alt text

Если одна роль является навигационной, а другая - нет, на ассоциации появляется стрелка (7) в навигационном направлении.

9
ответ дан 2 December 2019 в 04:43
поделиться