In a recent topic:
[size=13]Everything should be derivable[/size] I suggested that it would not be too far beyond the current UML specification to make everything (possibly) derivable.
In this topic I want to discuss a related topic. That of
inferred UMLElements.
Taking strict UML (for the moment), a UMLAssociation can be marked as derived (as Sparxian Ashely King points out, by using the
isDerived Custom Property of the EAAssociation).
So what does a derived association mean? Well, say we have a class OrganizationalUnit and another class Worker. Each Worker is assigned to an OrganizationalUnit (in functional notation assignedToOrganizationalUnit(worker) describes the association). In addition, each OrganizationalUnit has a Worker designated as manager (in functional notation managerOf(organizationalUnit) is the association). Now, it is often the case that we want to determine the manager of the Worker. Normally, the Worker's manager is the manager of the OrganizationalUnit the Worker is assigned to. In functional notation this would be: managerOf(worker). However as we have just described, the value of managerOf(worker) is not arbitrary. It is, in fact, managerOf(assignedToOrganizationalUnit(worker)). Thus we can state that managerOf(worker) is derived by traversal of managerOf(assignedToOrganizationalUnit(worker)).
So now I've described three associations; two are canonical and one is derived.
The
[size=13]UML 2.1 Superstructure (interim)[/size] Specification defines
isDerived as:
Specifies whether the Property is derived, i.e., whether its value or values can be computed from other information. The default value is false.If I decide to implement the managerOf(worker) association, then I have a derived association. But supposing I don't want to implement the association, but I'd still like to show it in the model (more specifically on diagrams) so as to aid understanding. How do I tell an implementable derived association from one one I don't intend to implement?
The solution we've come up with is to mark it as
inferred. Inferred relationships have many uses. For example, we might have a series of traversals via a set of CORBA interfaces and methods between a class in one component with a class in another component. To put the full complexity every time on a diagram would quickly make them unmanageable. Yet, placing only one link of the path doesn't come near telling enough of the story.
To solve this problem, on the diagram we place an «inferred» relationship between the source class and the target component. In diagram for the other side, we do the reverse. A third diagram shows the full traversal (and the relationship of the «inferred» relationships to the others).
Inferred relationships allow the creation of multi-level views and (as we have just seen cross-level relationships). They are useful summarising and abstraction mechanisms.
In a similar way, we can talk about inferred classifiers. Typical uses are a classifier in a state. You can create a specialisation of the classifier with the state as part of the name. Thus PaidOrder is an inferred specialization of Order. You can attach the specialized forms of the associations that only apply to PaidOrders and visually see the differences. Naturally, these associations will be inferred versions of the Order associations.
As suggested above, we currently use «inferred» stereotypes for this purpose, but we feel a proper property would be much better. It would be really neat if the property also set the rendering (like
isDerived sets the "/" prefix).
isInferred might set the prefix "\" or "(/)" or some other distinction.
Thoughts? Votes?
Paolo
[size=0]©2006 Paolo Cantoni, -Semantica-[/size]