DDD extract

Model and scenarios first before coding, coding just implementation of model, focus on business, not on database or technologies

Model based language

Model description – UML, text, anything

Layered architecture – UI, application, domain, infrastructure

Bounded context – common ubiquitous (with domain experts) language, all terms are uniq in scope of the bounded context, if there are two meaning of the same form – this definitely means that they belong to two different bounded contexts

Ubiquitous language (best implemented by BDD – given/when/then)

There will be design anyway, good (common for everyone, verified by domain experts) or bad (mix of multiple designs from multiple developers)

Context mapping – map of interconnected bound contexts.

Kinds:

  • partnership
  • shared kernel (try to avoid this)
  • customer-supplier
  • anticorruption layer
  • open host service

Entities and value objects – JPA

Modules

Aggregate – facade, root object that hides and manipulates underlying set/tree of child objects (entities)

Factory – creates new objects

Repository – stores (persists) already created objects

Services – stateless functions

How to improve the model:

  1. Listen domain experts, their language
  2. Build common language

Event sourcing (storing domain events, that represent changes at model, then calculate the current state when needed by merging these events)

CQRS