Dennis Traub @dtraub
strategic application development with
Domain-Driven Design
dotnet Cologne 2013 – 03. Mai 2013 – #dnc13
Dennis Traub @dtraub
Now, who‘s that guy?
Dennis Traub
Founder, Owner, CEO, Single Employee of
D. Traub Software Development Consultancy
@dtraub
Consultant, developer, trainer, speaker
39 years old
Married, father of one
Dennis Traub @dtraub
51
Blue Book
Actually it should
be two books!
Terminology
The Ubiquitous Language
2
An Example
Bounded Contexts
and Subdomains
3
Lasagna
… the new Spaghetti?
4
End
Questions & Answers
AGENDA
Dennis Traub @dtraub
Image Placeholder
The „Blue Book“ by Eric Evans
Dennis Traub @dtraub
• Entities
• Value Objects
• Aggregates
• Repositories
• Services
• Factories
• etc.
The „Blue Book“ by Eric Evans
Tactical
Class
Design
• Model Integrity
• Large-Scale Structure
• Bounded Contexts
• Core Domain
• Context Maps
• Ubiquitous Language
• etc.
Strategic
DDD
It should be two books!
Dennis Traub @dtraub
Domain
Dennis Traub @dtraub
a sphere of
knowledge, influence, or activity
Dennis Traub @dtraub
what an organization does
and the world it does it in
Dennis Traub @dtraub
Domain Model
Dennis Traub @dtraub
a system of abstractions that describes
selected aspects of a domain
Dennis Traub @dtraub
can be used to solve problems
related to that domain
Dennis Traub @dtraub
don‘t model reality
Dennis Traub @dtraub
we model useful abstractions of reality
Dennis Traub @dtraub
Ubiquitous Language
Dennis Traub @dtraub
a language structured around
the domain model
Dennis Traub @dtraub
used by all team members
Dennis Traub @dtraub
Bounded Context
Dennis Traub @dtraub
an explicit boundary within which
a domain model exists
Dennis Traub @dtraub
inside the boundary
all terms have specific meaning
Dennis Traub @dtraub
these terms are part of the context‘s
ubiquitous language
Dennis Traub @dtraub
Subdomains
Dennis Traub @dtraub
the whole domain of the organization
is comprised of subdomains
Dennis Traub @dtraub
they focus on only one
specific area of the whole business domain
Dennis Traub @dtraub
Core Domain
Dennis Traub @dtraub
the distinctive part of the model,
central to the users‘ goals
Dennis Traub @dtraub
differentiates the application and
makes it valuable
Dennis Traub @dtraub
the most important subdomain
Dennis Traub @dtraub
Example:
Dennis Traub @dtraub
Ambulance Flight Management
order flights from an operator
dispatch patients
assign medical staff
Dennis Traub @dtraub
Bounded Contexts
1 Patiententransport-Disposition
2 Flugplanung und -durchführung
3 Personaleinsatzplanung (Flugärzte, Rettungsassistenten)
4 Stammdaten, Rechnungswesen
5 Benutzerrechte, Web-Oberfläche
Dennis Traub @dtraub
Subdomains
6 Bodentransport
7 Abrechnung, Buchhaltung
8 Anwendungsoberfläche
9 REST-Schnittstelle
10 Benutzer- und Zugriffsrechte
1 Ambulanzflug-Disposition
2 Flottenmanagement
3 Flugplanung
4 Passagier-/Patientendaten
5 Medizinisches Personal
Dennis Traub @dtraub
remember, we don‘t build a model that
works for everyone
Dennis Traub @dtraub
to focus our effort and resources we ask
two questions for each subdomain
Dennis Traub @dtraub
how complex is it?
1
Dennis Traub @dtraub
what‘s the value to our specific problem?
(if we model it ourselves)
2
Dennis Traub @dtraub
Core Domain
6 Bodentransport
7 Abrechnung, Buchhaltung
8 Anwendungsoberfläche
9 REST-Schnittstelle
10 Benutzer- und Zugriffsrechte
1 Ambulanzflug-Disposition
2 Flottenmanagement
3 Flugplanung
4 Passagier-/Patientendaten
5 Medizinisches Personal
Ambulanzflug-Disposition
Dennis Traub @dtraub
we don‘t use DDD
when there is no value in
formalizing the problem
the tactical Building Blocks
Dennis Traub @dtraub
we only use DDD in parts
where we get a competitive
advantage
Dennis Traub @dtraub
Best Practice
Architecture
Dennis Traub @dtraub
DAL / O/R-Mapper
Domain / Business Model / BLL
Presentation Layer
Application Services
Infrastructure
CommonServices
Dennis Traub @dtraub
WCFData Access
UI
Business Logic
I/O
Dennis Traub @dtraub
Lasagna is the new Spaghetti
Dennis Traub @dtraub
UI Data Access
Domain Model
Application Services
I/OWCF Tests
Dennis Traub @dtraub
the D in SOLID
DependencyInversion Principle (just in case)
Dennis Traub @dtraub
UI Data Access
Domain Model
Application Services
I/OWCF Tests
Dennis Traub @dtraub
Source: Growing Object-OrientedSoftware, Guided by Tests -- Freeman & Pryce
Simple
Testable
Flexible
Dennis Traub @dtraub
Onion Architecture
Hexagonal Architecture
Ports & AdaptersArchitecture
Dennis Traub @dtraub
Summary
Dennis Traub @dtraub
DDD != Silver Bullet
Dennis Traub @dtraub
DDD != Diagrams
Dennis Traub @dtraub
DDD != Class Modeling
Dennis Traub @dtraub
DDD == how the business works
Dennis Traub @dtraub
DDD == Separation of Concerns
Dennis Traub @dtraub
DDD is basically the application of
the SOLID principles of object-orientation
on an architectural level
Dennis Traub @dtraub
Image Placeholder
The „Blue Book“ by Eric Evans
Dennis Traub @dtraub
Image Placeholder
Another essential Book
Dennis Traub @dtraub
Image Placeholder
And another one
Dennis Traub @dtraub
THANK YOU!
@dtraub – #dnc13

Strategic Appplication Development with Domain-Driven Design (DDD)