🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
MDrivenStart SingleAttribute
This page was created by Hans.karlsen on 2020-07-08. Last edited by Wikiadmin on 2026-07-29.

You can define one value on a class by giving an attribute a name, a simple type, and, when needed, a nullable marker; this page is for people defining class information in MDriven.

Write an attribute signature

An attribute holds one simple value for each object of a class. Write its name and type together in this form:

AttributeName:Type

For example:

SomeName:String

In this example, SomeName is the attribute name and String is the simple value type.

Allow an empty value

Add a question mark after the type when the attribute may have no assigned value:

SomeName:String?

The ? means the attribute is nullable. Nullable is different from a value such as zero. For an integer attribute, zero is an assigned value; a nullable integer can instead have no value assigned.

Signature Meaning
SomeName:String SomeName has the simple type String.
SomeName:String? SomeName has the simple type String and may have no assigned value.

Choose how the attribute is stored

Attributes are normally persistent: their values are saved. You can also use a non-persistent attribute when its value should exist only in memory.

For example, use a persistent attribute for information that must be retained. Use a non-persistent attribute for information that is only needed while the object is in memory.

Use a derived attribute for a calculated value

You can set an attribute's mode to derived when its value is calculated from other values rather than maintained as an independently entered value.

For example, if one value is calculated from other attributes, mark that calculated attribute as derived so the model expresses that it depends on those values.

Use an attribute or an association

Use an attribute for one simple value, such as a string. To represent a relationship to another class or a list of values, use an association instead.

Check the model

After adding or changing an attribute, use validation and resolve errors before you start the Prototyper or deploy the model.

See also