Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Data, State, and Truth

Every piece of software remembers things. A to-do app remembers your tasks. A banking system remembers your balance. An AI agent remembers the conversation so far. The moment a system starts remembering, hard questions follow: What shape should the data take? Where does it live? What happens when two parts of the system disagree about what’s true?

This section operates at the architectural level: the decisions about how data is structured, stored, and kept consistent that shape everything built on top of them. Get these patterns right and the system feels solid. Updates stick, queries return the right answers, and concurrent users don’t stomp on each other’s work. Get them wrong and you’ll chase phantom bugs, corrupt records, and slowly lose trust in your own system.

In agentic coding, these patterns matter in a specific way. An AI agent generating code will happily create redundant data structures, inconsistent state, or naive serialization unless the human directing it understands the underlying concepts. You don’t need to implement a database engine, but you do need to know why normalization matters, when idempotency saves you, and what it means to call something the source of truth.

This section contains the following patterns:

  • Data Model — The conceptual shape of the information a system cares about.
  • Schema (Database) — The formal structure of stored data.
  • Schema (Serialization) — The formal structure of data as encoded on the wire or on disk.
  • Data Structure — An in-memory way of organizing data so operations become practical.
  • State — The remembered condition of a system at a point in time.
  • Source of Truth — The authoritative place where some fact is defined and maintained.
  • DRY (Don’t Repeat Yourself) — Each important piece of knowledge should have one authoritative representation.
  • Data Normalization / Denormalization — Structuring data to reduce redundancy vs. intentionally duplicating for performance.
  • Database — A persistent system for storing, retrieving, and managing data.
  • CRUD — Create, read, update, delete — the basic operations on stored entities.
  • Consistency — The property that data and observations agree according to the system’s rules.
  • Atomic — An operation treated as one indivisible unit.
  • Transaction — A controlled unit of work over state intended to preserve correctness.
  • Serialization — Converting in-memory structures into bytes or text.
  • Idempotency — An operation that produces the same result when repeated.
  • Domain Model — The concepts, rules, and relationships of a business problem, made explicit so humans and agents share the same understanding.
  • Ubiquitous Language — A shared vocabulary drawn from the domain that every participant uses consistently in conversation, documentation, and code.
  • Naming — Choosing identifiers for concepts, variables, functions, and modules so that code communicates its intent to every reader, human or machine.
  • Bounded Context — A boundary around a part of the system where every term has one meaning, keeping models focused and language honest.