🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
Reverse Derivation
This page was created by Alexandra on 2018-10-17. Last edited by Wikiadmin on 2026-07-29.

Reverse derivation lets you accept an update to a derived, composite value and use EAL to write that value back into its separate underlying parts; it is for modelers who want a derived value to be editable.

What reverse derivation does

A normal derivation calculates one value from other values. For example, a model may derive a display value from several attributes.

Reverse derivation handles the opposite direction during an update:

Direction Purpose Example
Derivation Read separate values and calculate a composite value. Read Street and City to produce an address display value.
Reverse derivation Receive a new composite value and process it into separate values. A user changes the address display value; EAL processes the update into Street and City.

The derived value is therefore settable: it remains a derived representation for reading, while its update is handled by reverse derivation.

When to use it

Use reverse derivation when all of the following are true:

  • You have a composite value that is derived from separate model values.
  • You want a user or another update operation to set that composite value.
  • The new composite value can be processed into updates to the separate values.
  • You define that update processing in EAL.

For example, a model can expose one editable display value while retaining separate attributes in the domain model. The reverse derivation is responsible for interpreting the incoming display value and updating those attributes.

How it relates to derived settable attributes

Reverse derivation is the update-side behavior of a derived settable attribute. The ordinary derivation defines how the value is obtained when it is read. The reverse derivation defines what happens when that value is set.

Keep these two responsibilities separate:

  • Derivation expression: calculates the composite value from the underlying values.
  • Reverse derivation: processes a new composite value into updates of the underlying values.

This separation avoids duplicating the composite value as independently maintained data.

Design the update rule explicitly

Before making a derived value settable, define what each valid update means. In the address example, decide how the incoming value identifies its street and city parts. Also decide what happens when the incoming value cannot be interpreted into the required parts.

A reverse derivation should update the model values that the forward derivation reads. If it updates unrelated values, readers cannot predict how a later read of the derived value will relate to the value that was set.

EAL role

EAL is the code used to process the composite value during an update. Use it to assign the separate parts that represent the new value in the model.

The exact processing depends on the composite value and the model. For example, an address display value may require EAL that identifies its street and city portions before assigning the corresponding attributes. Do not treat the display string itself as the authoritative model structure when separate attributes are needed for the domain model.

Do not confuse this with database reverse engineering

Reverse derivation concerns updates to a derived model value. It does not create a UML model from a database.

For importing an existing database structure into a model, see HowTos:Reverse Engineer a Database and Documentation:Making sense of legacy data–DB Reverse.

Related derivation behavior

Derived attributes and associations centralize calculations in the model. They are recalculated when changes to values used by the derivation make their result out of date; see Training:Derived attributes & associations. You can define derivations for both attributes and association ends, and override inherited derivations where a subclass needs a different implementation; see Documentation:Derivation expressions.

A derivation is a model-level definition. When you need to use a derived definition in a persistent-storage query, see Documentation:Derivation is not available in the database.

See also