Derived Attribute

A derived attribute is an Attribute whose value can be computed from other attributes already in the model. – Executable UML, Mellor/Balcer

xUML uses and extends the definition in the Executable UML Mellor/Balcer book.

To be more specific, a Derived Attribute is computed from other Attributes within the same Domain in a state independent manner in a given slice of time. The first part goes without saying since Attributes in external Domains are always invisible. But the second part is less obvious. It means that all processing necessary to compute the current value of a Derived Attribute happens without the activation of any state transitions. To use one or more state transitions, as is often helpful, to compute an updated value of some Attribute, define that Attribute as an Independent Attribute instead.

A Derived Attribute is preceded by the / character on a class diagram.

Here is an example of a mathematically Derived Attribute on a single class:

Referential Attributes and Identifier Attributes within the same or other Classes may contribute in the construction of a Derived Attribute. In fact, a Derived Attribute may be computed based on other Derived Attributes as shown:

In the example above, Aircraft.Flying time is computed based on Fuel Tank.Quantity and Aircraft.Consumption rate. The Consumption rate itself may be computed based on other performance factors.

IMPORTANT: A Derived Attribute may not be, to any degree, derived from itself!

Attributes

Name

Non-Referential Attribute.Name

Class

Non-Referential Attribute.Class

Domain

Non-Referential Attribute.Domain

Formula

The algorithm, concatenation or other processing necessary to compute the current value of the Derived Attribute is defined as the formula. For now, this is informal text pending completion of the miUML Action Metamodel subsystem. (Action language will probably be used to specify Formulas in the future). Here are some examples:

Volume = Height * Pi * Radius^2
Code = <Organization>-<Number>
Flying time = self->fueled by->Fuel Tank.Quantity / Consumption rate

The text symbols employed in the above examples are entirely informal.

When is a Formula executed? In the example above Flying time could be computed upon each read access or, instead, each time the fuel quantity is updated. The choice is entirely implementation specific. Platform performance features must be taken into account to make the right choice. From an analysis perspective, the only thing that matters is that a correct value is obtained whenever \Flying time is accessed. Consequently, there is no need to express the time of execution for a Formula. It suffices to simply associate it with a Derived Attribute.

IMPORTANT: Each Attribute contributing in a Formula must be instantiated as an Attribute in Derivation for the Derived Attribute. In other words, no Attribute that is not an Attribute_in_Derivation where the Derived Attribute is the target may be used in the Derived Attribute’s Formula.

Type: Description

Identifiers

  1. Name + Class + Domain
    Same as the superclass.

Relationships

None.