8.2. Derived Attributes

Because an Executable UML model captures the information inherent in a domain, redundant attributes are generally frowned upon. However, there are occasions when a clear understanding of a domain is best served by capturing the dependency between attributes explicitly.

Definition: A derived attribute is an attribute whose value can be computed from other attributes already in the model.

Figure 8.9 shows two derived attributes, each prefixed by a / (slash).

Figure 8.9. Derived Attributes

The attribute ProductSelection.selectionValue can be defined in OCL like this:

context Selection inv:       Self.selectionValue =                ...

Get Executable UML: A Foundation for Model-Driven Architecture now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.