Development

Domain models before code: the fastest route to maintainable software

Strong product systems start by naming entities, states, transitions, invariants, and ownership before teams commit to UI or database tables.

Published
Reading time
6 min read
Written for
Engineering leads, founders, product managers, and teams building workflow-heavy products.

Most software complexity is imported through unclear language. Domain modelling reduces that complexity before it becomes duplicated logic across interfaces, APIs, and operations.

Key points

  • Model behavior and state transitions before modelling screens.
  • Use business language for entities and invariants.
  • Let the domain model expose missing product decisions early.

Foundation

Name the business objects precisely

A product with vague objects produces vague code. Terms like request, order, booking, listing, asset, lead, case, and job carry different lifecycle rules. Write those rules down before deciding API names or database schema.

  • Define each entity by responsibility, not by where it appears in the UI.
  • Capture lifecycle states and which actor can move between them.
  • Document invariants that must remain true across every workflow.

Architecture

Make state transitions explicit

Important systems rarely fail because a page cannot render. They fail because state changes are inconsistent: payment succeeds but order fails, approval changes without audit, inventory updates without reservation, or a user sees a stale permission.

  • Represent important transitions as commands or events with clear ownership.
  • Design idempotency before connecting external systems.
  • Keep derived state traceable to the event or rule that produced it.

Delivery

Use the model to sequence the build

A good domain model becomes a delivery map. Build the core lifecycle first, then add convenience screens, dashboards, and automation around it. This prevents early UI work from hiding unresolved product logic.

  • Prioritize workflows that create or change core entities.
  • Add admin tools where manual operation is acceptable during launch.
  • Delay complex automation until the underlying states are trustworthy.

Domain modelling checklist

  1. Core entities and exact business definitions
  2. Lifecycle states and permitted transitions
  3. Actors, roles, permissions, and audit requirements
  4. Invariants and validation rules
  5. External system boundaries and sync behavior
  6. Reports, search indexes, and derived views

Related services

SuperLabs terminal

Type help for commands, or eggs to see what is hidden. Escape closes.