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.

Conceptual Shape

How data is described, modeled, and named: the vocabulary that keeps humans and agents aligned.

  • 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.
  • Domain Model — The concepts, rules, and relationships of a business problem, made explicit so humans and agents share the same understanding.
  • Entity — A thing in your domain that has a distinct identity, persists through change, and can be told apart from every other thing of its kind.
  • Value Object — An object defined entirely by its attributes, with no identity of its own. Two value objects with the same data are the same thing.
  • Aggregate — A cluster of entities and value objects treated as a single unit for data changes, with one entity guarding the boundary.
  • Bounded Context — A boundary around a part of the system where every term has one meaning, keeping models focused and language honest.
  • Business Capability — A stable name for what a business does, independent of who does it or how, giving strategy, software, and teams a shared anchor.
  • 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.
  • Coding Convention — Written, agreed rules about how the team writes code, captured as a living artifact that both humans and AI agents can read and follow.

Operations and Storage

How data moves, persists, and survives: the mechanics of reading, writing, and keeping things safe.

  • State — The remembered condition of a system at a point in time.
  • Database — A persistent system for storing, retrieving, and managing data.
  • CRUD — Create, read, update, delete — the basic operations on stored entities.
  • Transaction — A controlled unit of work over state intended to preserve correctness.
  • Atomic — An operation treated as one indivisible unit.
  • Idempotency — An operation that produces the same result when repeated.
  • Serialization — Converting in-memory structures into bytes or text.

Truth and Consistency

How you keep data honest: the principles that prevent contradiction, drift, and silent corruption.