DDD / Event Sourcing

Uhh, again

CQRS

  • Different models for read/write
  • Domain events syncing the 2 models
  • Eventual consistency

Quick Glossary

Aggregate

A group of objects that represent a domain concept and need to be consistent together

Aggregate Root

The entry point to an aggregate, enforcing the invariants

Bounded Context

A system which shares domain language

Invariant

A condition that is always true

Unit of Work

A pattern to ensure all transactions succeed or fail together

Sample: Modeller

Column: Commands

  • Create Column
  • Rename Column
  • Change Data Type
  • Make Primary
  • Clear Primary

Invariants

  • A date column cannot be a primary key

Some Issues...

  • That UoW stuff is a little invasive, and brittle
  • So is that IEventBus dependency
  • Did you spot the bug?

Write Model

Name: New Column Name

Data Type: Date

Primary Key? No

Read Model

Name: New Column Name

Data Type: Date

Primary Key? Yes

Multiple Sources of Truth

Event Sourcing!

Event Sourcing

By xwipeoutx

Event Sourcing

  • 682