tPl0ch / ddd-process-time-state

Repository from Github https://github.comtPl0ch/ddd-process-time-stateRepository from Github https://github.comtPl0ch/ddd-process-time-state

Functional Aggregate Design

Processes, Temporality & Automata Theory

This repository contains the example code to my talk I have given at Domain-Driven Design Europe '22. I recommend giving the slides a look before diving into the repository.

It shows how one can use the mathematical definition of a Transducer, decompose it to its individual parts and create a functional DDD Aggregate implementation.

Requirements

  • JVM 11+
  • SBT 1.6+

How to get started

Run the examples in the example folders

I recommend firing up the debugger and making breakpoints wherever you want to get an idea of how the examples work.

  1. Simple state store with a regular state machine
  2. State store & Event publishing through Transactional Outbox
  3. Event-Sourcing
  4. Read-Model projection
  5. Various Error scenarios

The main point here is that in order to implement all these different use-cases, you don't have to change the model at all. We can just use composition to create use-cases of any complexity.

Have a look at the domain

  1. Domain model
  2. Behaviors
  3. Events
  4. Required implicit instances
  5. Read model
  6. Type aliases
  7. Generation of State Machine & Transducer based Aggregates

Check out the implementations

  1. Lifecycle
  2. Invariants
  3. Transitions
  4. Aggregate initialization
  5. Event-Sourcing

Feedback

Feedback is very welcome! Let me know if you find something that can be improved or is hard to understand.

About


Languages

Language:Scala 100.0%