SlideShare a Scribd company logo
TACTICAL DDD
Just better OOP?
Matthias Noback
@matthiasnoback
matthiasnoback/

tactical-ddd-workshop
Clone from GitHub
Follow the instructions in README.md
TACTICAL DDD
As opposed to...
STRATEGIC DDD
The big picture
Ubiquitous language
Domain and subdomains
Bounded contexts
Context mapping
Collaboration
Discovery
TACTICAL DDD
Design patterns
Aggregate
Entity
Value object
Repository
Domain service
Factory
TACTICAL DDD
Its concerns
Performance
Reliability
Data integrity
Insight
DDD
Scaling your domain model
Keep it consistent
Keep it manageable
Make it perform well
Ubiquitous language
Bounded contexts
Aggregates
ENTITIES
Change & identity
Identity
Provided by user, application or persistence mechanism
Repository encapsulates identity generation
Surrogate identity
Mutability & individuality
Validation & consistency (encapsulation)
ENTITIES
Checklist
Does the object need to be retrieved from a repository by its
unique identity?
Does the object need to track changes?
Are two instances equivalent if they have the same identity?
VALUE OBJECTS
Properties
Descriptive
Immutable
Conceptual whole (composite)
Replaceable
Not identifiable but comparable
Side-effect free behaviors
VALUE OBJECTS
Checklist
Is it irrelevant which exact instance of the object is used?
Can the object be replaced, instead of modified?
Are two objects of the same type equal if their properties
contain equal values?
assignment/01.md
Entities and value objects
AGGREGATES
Consistency
Consistency boundary
Transactional consistency
Eventual consistency
“When examining the use case (or
story), ask whether it's the job of the
user executing the use case to make
the data consistent.
AGGREGATES
Rules of thumb
Small aggregates
Reference aggregates by identity
Use eventual consistency
AGGREGATES
Implementation
Root entity with unique identity
Favor value object parts
Use Law of Demeter and Tell, Don't Ask
Optimistic concurrency
Avoid dependency injection and references to static services
assignment/02.md
Extract an aggregate
DOMAIN EVENTS
Messages
Immutable
Relation with commands
Authoritative
Sufficient data
assignment/03.md
Domain events
REPOSITORIES
Persistence
Collection or persistence oriented
Persistence implementation
Unit of Work, change set calculation
Event-sourcing
Reconstitution
Querying
ASSIGNMENT/04.MD
An aggregate repository with an event store
Feedback? https://joind.in/talk/e8a3a
APPLICATION SERVICES
Clients of the domain model
Task coordination of use case flows
Transaction control
No business domain logic
assignment/05.md
Application services
THAT'S IT!
Thanks
Feedback? https://joind.in/talk/e8a3a
Feedback? https://joind.in/talk/e8a3a
Feedback? https://joind.in/talk/e8a3a

More Related Content

Tactical DDD (just better OOP?) - PHPBenelux 2017