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

An attribute stores one typed value for each object of a class; use it when you need to record a property such as a customer's name, an invoice number, or whether an order is paid.

Use attributes for single values

An attribute represents a simple value: one value of a declared type for one object. Define both its name and type so that the model knows what kind of information the attribute may hold.

For example, a Customer class can have an attribute written as:

Name:String?

This defines Name as a string value. The ? means that the value is nullable: a customer may have no name assigned yet. For an integer attribute, nullable is significant because 0 and no assigned value are different values.

Read Single Attribute for the attribute notation and its persistence and derivation settings.

Choose an appropriate type

The attribute type states the kind of one value the attribute stores. Choose a type that matches the information you need to record.

Requirement Example attribute Meaning
Record a customer's name Name:String? One text value, which may be unassigned.
Record an item quantity Quantity:Integer One whole-number value.
Record whether an invoice has been paid IsPaid:Boolean One true-or-false value.

An attribute holds one value, not a collection. If a customer can have several invoices, model the relationship between Customer and Invoice as an association, rather than trying to store a list in an attribute.

Decide whether the value may be empty

A nullable attribute can hold no assigned value. Use nullability when the information is optional or is not known when the object is created.

For example:

MiddleName:String?

A customer without a middle name has no value for MiddleName. This is different from storing an empty text value, and for numeric types it is different from storing zero.

Attribute behavior

Attributes are normally persistent, which means their values are saved. An attribute can instead be non-persistent, keeping its value only in memory. You can also set an attribute to derived when its value is calculated from other values. See Single Attribute for these settings and derivation details.

For information that must progress through controlled states, use a state machine attribute. A state machine limits the allowed state values and defines the permitted transitions between them.

Model attributes in context

Define attributes as part of describing an information class:

  1. Open the class you want to describe, such as Customer.
  2. Add an attribute for each single property the class must store.
  3. Give each attribute a meaningful name and an appropriate type.
  4. Mark the attribute nullable when no value is allowed or expected at some point in its lifecycle.
  5. Use an association instead when the class must refer to one or more objects of another class.
  6. Validate the model before you run it or deploy it. Verify identifies model errors when you save and when you run validation manually.

For the wider modelling workflow, see Define Information. You can then use diagrams to show the attributes and associations that are relevant to a particular part of the model.

See also