Architecture:MediaWiki/data object pattern

The data object pattern is often used when modelling domain entities, across all layers. Data objects are generally simple wrappers around a data structure that represents the properties of the object in question.

Data objects are typically, though not always, lightweight, serializable, and newable.

Subtypes:
 * A record is a data object that is defined in the persistence layer and can be retrieved using a unique identifier.
 * An immutable value is a data object that cannot be modified. It takes all information as constructor arguments, and provides getters to access this information. It does not perform I/O operations, and has no access to service objects.
 * An exception is a data object that extends the pre-defined Extension class. Exceptions should be immutable value objects.
 * An active record is a data object that implements its own persistence logic, it can load itself from storage, and update itself in storage. This pattern should generally be avoided, since it typically relies on global state.
 * A content objects represents user editable content from the content representation domain.

Layer constraint: Data objects can be useful in all layers.

Status: As of June 2020, the data objects are used throughout the MediaWiki codebase. However, they are often not entirely independent of global state, and some prominent examples like the Title and User objects are extremely heavy and belong to the active record subtype.

Examples: An example of the command pattern is the  class.