This document discusses an approach to developing complex software that focuses on the core domain, explores models through collaboration, and uses a ubiquitous language within a bounded context. It emphasizes isolating the domain and using domain-driven design principles like entities, value objects, aggregates, domain services, and events to represent the domain model in software. Common pitfalls include treating DDD as a recipe rather than understanding the domain. DDD aims to reveal intentions through interfaces, side-effect-free functions, and other formalisms.
3. An approach to the development of complex software
In which we:
1. Focus on the core domain
2. Explore models in a creative collaboration of domain practitioners and software
practitioners
3. Speak a ubiquitous language within an explicitly bounded context
5. DOMAIN
A sphere of knowledge,
influence, or activity. The
subject area to which the user
applies a program is the
domain of the software.
7. Essentially, all models are wrong, but
some are useful.1
System of abstractions
Describe selected aspects of the domain
Solve problems
1: George E. P. Box, British
8. A language structured around
the domain model and used by
all team members within a
bounded context to connect all
the activities of the team with
the software.
12. Responsible for showing information to the user and
interpreting the users commands.
External actor can be
- A human user or;
- Another computer system.
18. An object primarily defined by its
identity
Artificial x Natural identity
Anemic Domain
(aka Reference Objects)
https://docs.microsoft.com/en-us/dotnet/standard/microservices-architecture/microservice-ddd-cqrs-patterns/microservice-domain-model
22. Root Entity (also called Aggregate Root)
State changes are made via the root Entity, which ensure the Business rules and
keeps the Aggregate valid
All children have a reference to the root Entity
Deletion of the aggregate/root, deletes all children;
25. 3 types of services
Application Services
Domain Services
Infrastructure Services
Characteristics of a good Domain Service
Operation relates to a domain concept that is not a natural part of na Entity or
Value Object
The interface is defined in terms of other elements of the domain model
The operation is stateless
26. FACTORIES
When creation of an entire, internally consistente
aggregate, or a large value object, becomes
complicated or reveals too much of the internal
structure, factories provide encapsulation.
27. Query access to aggregates expressed
in the ubiquitous language.
Act in a similar way to a set of
domain objects in memory
Persistence Ignorance Principle
One repository per aggregate
No business rules
29. A representation of something that happened in the domain
Immutable
Domain Event != System Event
31. COMMON
PITFALLS
Relational database mindset masked as
DDD
Treating DDD as a recipe
Starting with technical details
Being superficial about the Domain
The "One model to rule them all"
approach
41. ANDRE BORGONOVO
Software Consultant at WAES
Design Engineer at ASML
MCSD, PSM, ITIL
linkedin.com/in/azborgonovo
@azborgonovo
Software Developer | Leader | Architect
Editor's Notes
#5: Increases the project architecture quality
Decreases complexity
Improves the manutenability
You make software to run for years
Who should care about Domain-driven design?
DDD is forever (technology independente, not only OOP)
Comes along with other DDs
#6: The focus is on the domain
NOT on the database
Business software with complex rules
#8: Should be kept up to date
Use POCO (Plain Old CLR Objects)
#9: Ubiquitous = it is everywhere
The language used by the Business expert = Domain expert = Product Owner
Do not use tech language to talk with the Domain expert
Proximity with the Domain expert
Analysis should be natural to the Domain expert
Nouns => Classes
Verbs => Methods, services
#10: Continuous Integration => Once a bounded context has been defined, we must keep it sound
#12: Layers vs Tiers, Tier is a physical unit where the code/process runs
Separation of Responsabilities
Flexible architecture
#14: Thin layer, no domain logic, no state (only state for long running processes)
Commands
DTOs
Command Handlers
Domain Event Handlers
#17: Hexagonal Architecture
If I have this architecture, do I have DDD?
https://blog.ploeh.dk/2011/07/28/CompositionRoot/
#19: An entitys identity can cross multiple microservices or Bounded Contexts.