liveBook · Manning

Domain model

As explained in Go in Action, Second Edition

A domain model is a representation of the concepts and relationships in a problem domain that software components conform to.

A domain model represents the core concepts and relationships of a problem domain independently of technical implementation. In a modular Go system, it gives API and worker modules a shared vocabulary while keeping business logic independent of databases, HTTP frameworks, and other infrastructure. section 11.1.2

A practical domain model separates nouns from verbs:

  • Entities such as Article and Feed define the system's core data, using portable standard-library types such as time.Time. section 11.1.2
  • Interfaces such as Fetcher, ArticleReader, and Storage define required behavior without prescribing implementations. section 11.1.2
  • Dependencies point inward: API, worker, storage, and protocol code depend on domain abstractions rather than the domain depending on infrastructure. section 11.1.2 section 11.3.6

RSS system domain

An RSS application can define Article and Feed in a domain package, then expose Fetcher for retrieving feeds and Storage for persisting articles. The API and background worker consume these contracts while choosing their own HTTP, parsing, or persistence implementations. section 11.1.2 section 11.3.6

Figure 11.3 Domain-driven design separates core logic from infrastructure.

Use the architecture diagram to trace the domain at the center and the one-way relationships between core logic, ports, adapters, API, and worker modules. section 11.1.2

How Go in Action, Second Edition covers it

How deep it goes
Defines entities, interfaces, and dependency direction, but leaves concrete infrastructure implementations outside the domain.
Examples
Uses Article, Feed, Fetcher, ArticleReader, Storage, API, worker, RSS, and Atom examples.
What you can do after
Build it from scratch by defining portable entities and interfaces that multiple Go modules can consume without tight coupling.
How it connects
Connects domain-driven design, dependency inversion, hexagonal architecture, interfaces, API modules, worker modules, and storage.

Also explained in

Compare how 8 books explain domain model →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Go in Action, Second Edition. The section links point to the parts of the book it draws on.