Skip to main content

Causality-Oriented Modeling

Causality-Oriented modeling treats events, facts, causality, and adjudication as the smallest meaningful units for organizing a system.

This stands in contrast to object-oriented modeling:

Object-OrientedCausality-Oriented
Objects, classes, and methods are the primary unitsEvents, facts, and adjudication rules are the primary units
Bottom-up: define objects first, then manage event flowTop-down: define how facts are formed, then derive representation
State is scattered across private object spaceState is derived from the Causal Layer; the Perception Layer holds only projections
Spatial structure: encapsulation, inheritance, polymorphism, compositionTemporal structure: Event -> Adjudication -> Fact -> Propagation
Who owns what?Who caused what?

Causality-Oriented is most useful for systems that run continuously, interact constantly, and must keep absorbing change.

It is grounded in a relational ontology rather than a state ontology.

Two-Layer Model

The model divides a system into two cooperating layers: the Causal Layer and the Perception Layer.

Causal Layer

The Causal Layer is the system's event interpretation and adjudication engine.

It maintains three core assets:

  • Pending Events: semantic events that have entered the system and are waiting to be interpreted
  • History of Facts: the sequence of relational facts already admitted into history
  • Adjudication Rules: the rules used to interpret events, resolve conflicts, and compute outcomes

When modeling the Causal Layer, the primary principle is always relation first: maintain the rules that produce state changes, rather than treating state itself as the core asset.

Perception Layer

The Perception Layer is the reactive projection of world facts. It is responsible for:

  • Consuming facts and turning them into projections
  • Detecting external change and packaging it into semantic events
  • Organizing continuous presentation, local feedback, and user experience

The Perception Layer may hold local state, such as a panel being expanded, animation progress, whether a notification has been read, or camera tweening. These states are derived from facts and do not themselves constitute world facts.

The Perception Layer may also present predicted feedback ahead of adjudication in order to improve responsiveness. For example:

Player presses attack -> Perception Layer immediately plays an attack animation
-> reports attack_requested -> Causal Layer adjudicates
-> Causal Layer returns damage_applied -> Perception Layer corrects the presentation

Animation may run ahead, but facts such as damage and death only truly take effect after the Causal Layer confirms them. If a local state can influence future world facts, it must be submitted to the Causal Layer as a semantic event.

Interaction Between Layers

External input -> Perception Layer detects -> Semantic event -> Causal Layer adjudicates -> New fact -> Perception Layer consumes -> Presented to the outside world

Architecturally, the Perception Layer does not directly rewrite world facts. It can only request adjudication through semantic events. The Causal Layer does not directly handle presentation; it publishes facts for the Perception Layer to consume.

Boundary Criteria

To decide which layer a feature belongs to, ask:

  1. Does it affect future world facts?
  2. Does it need to enter history, remain traceable, or be shared across multiple nodes?
  3. If it were lost or rolled back, would it cause a serious bug?

A simpler principle: the Causal Layer handles discrete relational changes, while the Perception Layer handles continuous projection and feedback.

Decision Dimensions

DimensionCausal LayerPerception Layer
Authoritative facts / local presentationCentralized adjudication, traceability, determinismLow-latency feedback, local autonomy, safe to discard
Causal adjudication / state projectionMany conflicts, explicit conditions, ordering concernsMostly stable relations, driven by local snapshots and derived state
Temporal order / spatial organizationSequence, windows, concurrency, preemptionStructure, layout, composition, hierarchy
Global convergence / local responseAll nodes must eventually face the same factual versionDifferent nodes may temporarily keep different projections and timing

The Causal Layer is discrete; the Perception Layer is continuous. The Causal Layer owns authoritative facts; the Perception Layer owns projection and presentation.

Mapping to Different Systems

Applying these dimensions gives the following mapping:

ScenarioCharacteristicsTypical solution
Online game combatHigh authority, strong global consistency, rich local feedbackAuthoritative server as Causal Layer; clients as Perception Layer with prediction; deterministic event sync; temporary state windows; GGPO / rollback
E-commerce orderingHigh authority, medium real-time pressure, strong traceabilityEvent Sourcing + CQRS; Saga / workflow; eventual consistency plus compensation
Real-time collaborative whiteboardHigh local autonomy, strong global convergence, brief divergence acceptableCRDT / OT for local editing; central service maintains canonical history and convergence; reactive UI subscribes to fact updates
Traditional CMSHigh local state density, low causal density, medium authorityConventional MVC / CRUD; no elaborate Causal Layer required

Common Pitfall

Trying to guarantee synchronization by moving all state into the Causal Layer usually backfires. The Causal Layer swells into a new state center and the entire point of layering is lost. The Causal Layer should maintain only the versioned relational facts; the Perception Layer should remain free to interpolate and predict between them.

Relation to Other Concepts

  • The Causal Layer is not the same as Event Sourcing: Event Sourcing assumes that events are already facts and focuses on storage and replay. The Causal Layer treats events as inputs that still need interpretation. They may conflict, they may be invalid, and they only become facts after adjudication. The Causal Layer may use Event Sourcing as a storage technique, but Event Sourcing itself does not include interpretation, adjudication, or consistency guarantees.
  • The Perception Layer is not the same as the View in MVC: a View is usually passive. The Perception Layer also detects input, segments change into events, and organizes continuous feedback without directly altering world facts.
  • Eventual Causal Consistency is not the same as eventual consistency: in distributed systems, eventual consistency allows temporary divergence but ultimately converges on state. In Eventual Causal Consistency, each participant's projection of facts may be incomplete, but all participants must eventually face the same factual version of the world; the emphasis is on causality.