Shop Domain Model

Version Latest

Shop Domain Model

Table of Contents

  1. Table of Contents
  2. Introduction
  3. Shop Domain
    1. Shop
      1. Aggregates
        1. Customer
        2. Message
        3. Order
        4. Product
      2. Domain Processes
        1. CustomerCreation
        2. Messaging
        3. OrderPlacement
        4. OrderSettlement
        5. OrderShippment
        6. ProductManagement
  4. Ubiquitous Language

Introduction

This document describes Shop domain using concepts defined by Domain-Driven Design (DDD) methodology. It was generated directly from source code and can be considered as a close summary of what is actually implemented. A description of followed conventions is given below.

The document is split in two parts:

  1. the description of the different modules and their components,
  2. the ubiquitous language, presented in the form of a glossary. Each entry is composed of a name, the module (if relevant), the type of component and a short description.

Modules

Each module has its own section, each containing sub-sections for each aggregate, service and domain process in the module.

Each module section starts with the description of the module and an undirected graph. The nodes represent the aggregates of the module and the edges represent the links between those aggregates. A link between two aggregates means that one aggregates holds a reference to the other in its attributes.

Aggregates

Each aggregate section starts with the description of the aggregate and an undirected graph. Each node of the graph represents a component (an entity or a value object) part of the aggregate. The edges represent links between the components of the aggregate.

Follows the description of the Value Objects and Entities part of the aggregate and represented in the aggregate graph.

The aggregate section ends with a directed graph showing how current aggregate is connected to other aggregates, modules or external systems in terms of consumption and transmission of events.

Current aggregate is represented by a box with bold borders, other aggregates are represented by boxes with a thin border. Dashed boxes represent other modules or external systems issuing or consuming events. Elliptic nodes represent the events.

An edge going from a box to an ellipse means that the component represented by the box issues the event represented by the ellipse. An edge going from an ellipse to a box means that the component represented by the box consumes the event represented by the ellipse.

Domain Processes

Each domain process section starts with the description of the process and a directed graph.

Each node of the graph represents a message listener (ellipses) or other modules or external systems (boxes) producing and/or sending messages.

Each directed edge represents a message being produced by source node and consumed by destination node.

The section ends with the list of message listeners involved in the process and their description. The naming convention for the message listeners is

Aggregate.listenerName(Event)
where
Aggregate
is the name of the aggregate being created/updated/deleted,
listenerName
is the name of the listener inside of the component and
Event
is the name of the consumed event or command.

Shop Domain

Shop

Models an online shop where Customers may buy Products by placing Orders. Customers receive Message giving them an update about the handling of their Orders.

Aggregates

Customer

A Customer can place Orders and receive Messages.

Events

Message

Messages are sent to Customers to notify them about an event.

Value Objects
Events

Order

Orders are placed by Customers when they buy a given number of units of a given Product. An Order is first created, then settled (upon receivable of Customer's payment), and finally shipped (when passed over to transporter).

Value Objects
Events

Product

A Product is a good or service that can be bought by a Customer. Customer have to place an Order when buying units of a given Product. The number of available units may be increased and is decreased with successfully placed Orders.

Events

Domain Processes

CustomerCreation

Executed when creating a new Customer.

Messaging

Executed when sending a message to a Customer.

OrderPlacement

Executed when a Customer places an order.

OrderSettlement

Executed when an Order is settled.

OrderShippment

Executed when an Order is shipped.

ProductManagement

Executed when managing a Product i.e. creating it or adding some units to it.

Ubiquitous Language

  1. ContentType (Shop), Value Object, The type of message to send.
  2. Customer (Shop), Aggregate, A Customer can place Orders and receive Messages.
  3. CustomerCreation (Shop), Domain Process, Executed when creating a new Customer.
  4. Message (Shop), Aggregate, Messages are sent to Customers to notify them about an event.
  5. Messaging (Shop), Domain Process, Executed when sending a message to a Customer.
  6. Order (Shop), Aggregate, Orders are placed by Customers when they buy a given number of units of a given Product. An Order is first created, then settled (upon receivable of Customer's payment), and finally shipped (when passed over to transporter).
  7. OrderId (Shop), Value Object, An Order identifier consists in a Product ID, a customer ID and a reference enabling a Customer to place several orders for the same Product and still distinguish them.
  8. OrderPlacement (Shop), Domain Process, Executed when a Customer places an order.
  9. OrderSettlement (Shop), Domain Process, Executed when an Order is settled.
  10. OrderShippment (Shop), Domain Process, Executed when an Order is shipped.
  11. Product (Shop), Aggregate, A Product is a good or service that can be bought by a Customer. Customer have to place an Order when buying units of a given Product. The number of available units may be increased and is decreased with successfully placed Orders.
  12. ProductManagement (Shop), Domain Process, Executed when managing a Product i.e. creating it or adding some units to it.
  13. Shop, Module, Models an online shop where Customers may buy Products by placing Orders. Customers receive Message giving them an update about the handling of their Orders.