SlideShare a Scribd company logo
Domain-Driven Designwith ASP.NET MVC 
Steve Smith 
CTO, Falafel Software 
@ardalis| steve.smith@falafel.com
What is Domain-Driven Design (DDD)?
Domain-Driven Design with ASP.NET MVC
Communication 
•Ubiquitous Language 
•Domain Expert Interaction 
Modeling 
•Core Domain 
•Generic Subdomains 
•Bounded Context 
•Context Map 
•Shared Kernel 
•Anti-Corruption Layer 
Implementation 
•Model-Driven Design 
•Layered Architecture 
•Entities 
•Value Objects 
•Services 
•Factories 
•Aggregates 
•Repositories 
•Domain Events
DDD is BIG 
“The more you know, the more you realize you know nothing.” 
Socrates
DDD Fundamentals Course 
•Over 4 hours of content (demos using MVC + SignalR) 
•http://bit.ly/PS-DDD
DDD Benefits 
•Flexibility 
•Software models customer’s understanding of problem 
•Breaks complexity into manageable pieces 
•Well-organized; easily tested 
•Business logic lives in one place
DDD Drawbacks 
•Time and Effort 
•Learning Curve 
•Overkill without Complexity 
•“Anemic” domain model problem
Communication 
“As software developers, we fail in two ways: we build the thing wrong, or we build the wrong thing.” 
Me
Domain-Driven Design with ASP.NET MVC
Ubiquitous Language 
http://upload.wikimedia.org/wikipedia/commons/2/23/Rosetta_Stone.JPG
Language 
“A project faces serious problems when its language is fractured.” 
Eric Evans
Ubiquitous Language 
•Ubiquitous–adjective. Present, appearing, or found everywhere. 
•Synonyms: pervasive, universal 
•Used within a given Bounded Context 
•Used in code, design documents, and conversations 
--Everywhere
DomainTerms 
Domain Experts 
Problem Domain 
Core Domain 
Sub-Domains
Bounded Contexts 
•Provide Separation of Concerns 
•Limit complexity 
•Should be clearly boundedand separate
Appointment Scheduling 
Billing
Appointment Scheduling 
Billing 
Anti- 
Corruption 
Layer
Model Driven Design 
Not Data-Driven
Layered Architecture 
•Ports and Adapters 
•Hexagonal 
•Onion
Organizing in a Solution
Entities 
“Many objects are not fundamentally defined by their attributes, but rather by a thread of continuity and identity.” 
Eric Evans
Changing Attributes Doesn’t Change Which One We’re Talking About 
ID:1 
•Name: Steve Smith 
•Twitter: @ardalis 
•Favorite Color: Blue 
ID: 1 
•Name: StevenSmith 
•Twitter: @ardalis 
•Favorite Color: Blue 
ID: 1 
•Name: Steven Smith 
•Twitter: @ardalis 
•Favorite Color: Orange
Domain-Driven Design with ASP.NET MVC
Domain-Driven Design with ASP.NET MVC
Value Objects 
•Defined by their attributes 
•Immutable 
•Should have no side effects 
•Examples: strings, addresses, currency
Domain-Driven Design with ASP.NET MVC
Immutable!
Domain Services 
•Not a natural part of an Entity or Value Object 
•Interfacedefined in terms of other model elements 
•Should be stateless(but may have side effects)
Services in Different Layers 
UI Layer 
& Application Layer 
Infrastructure 
Domain 
(“Application Core”) 
Message Sending 
Message Processing 
XML Parsing 
UI Services 
Transfer Between Accounts 
Process Order 
Send Email 
Log to a File
Domain Events 
“Use a Domain Event to capture an occurrence of something that happened in the domain.” 
Vaughn Vernon 
Implementing Domain-Driven Design
Domain Event Tips 
•Consider for cases of “whenthis happens, then…” 
•Or “Notify someone when…” 
•Domain events represent the past 
•They already happened 
•Thus, they should be immutable
Examples of Domain Events 
UserAuthenticated 
Appointment 
Confirmed 
PaymentReceived 
$¢£¥
Designing Domain Events 
•Each Event is a Class 
•Use a common interface (e.g. IDomainEvent) 
•Capture when the event took place 
•Include details 
•What would you need to know to trigger this event again? 
•Include identitiesof any entitiesinvolved 
•Initialize all state in constructor 
•No behavior or side effects –just state
More DDD Topics 
•Aggregates 
•Repositories 
•Factories 
DDD Fundamentals on Pluralsight 
Eric Evans’ DDD Book 
steve.smith@falafel.com
Domain Models and MVC Models 
•UI interacts directly with Domain Model 
•Entities, Value Objects 
•Interfaces, Services 
•Views may work with custom ViewModels 
•Client (HTML/JS) code may use another ViewModelas well
Controllers 
•Keep as small as possible 
•Eliminate business logic 
•Inject all dependencies
Views 
•No logic unless encapsulated in tested helpers 
•No business logic if it can instead be modeled in the domain
SignalR 
•Awesome addition to ASP.NET 
•Great for notifications to multiple users 
•Ties in easily with Domain Events
Solution Structure 
•Core 
•Interfaces 
•Model (Entities, Value Objects) 
•Domain Services 
•Infrastructure 
•DbContext 
•File Access 
•System Clock Access 
•Email services 
•Web 
•MVC Project 
•No direct use of Infrastructure
Demo 
Putting DDD into ASP.NET MVC
Domain-Driven Design with ASP.NET MVC

More Related Content

What's hot (20)

PPTX
React workshop
Imran Sayed
 
PDF
Sécurité des Applications Web avec Json Web Token (JWT)
ENSET, Université Hassan II Casablanca
 
PPTX
Kubernetes PPT.pptx
ssuser0cc9131
 
PPTX
Domain Driven Design
Ryan Riley
 
PDF
Introduction to jest
pksjce
 
PPTX
Bootstrap
AvinashChunduri2
 
PDF
ReactJS presentation
Thanh Tuong
 
PDF
Understanding react hooks
Samundra khatri
 
PDF
Domain Driven Design (Ultra) Distilled
Nicola Costantino
 
PPTX
Domain Driven Design 101
Richard Dingwall
 
PDF
GraphQL
Joel Corrêa
 
PPT
Domain Driven Design (DDD)
Tom Kocjan
 
PDF
React js
Rajesh Kolla
 
PPTX
Domain Driven Design
Nader Albert
 
PPTX
jQuery
Dileep Mishra
 
PDF
Flink Forward Berlin 2017: Aris Kyriakos Koliopoulos - Drivetribe's Kappa Arc...
Flink Forward
 
PDF
How to go about testing in React?
Lisa Gagarina
 
PPTX
ASP.NET Lecture 1
Julie Iskander
 
PDF
Gitlab CI : Integration et Déploiement Continue
Vincent Composieux
 
PPTX
Implementing DDD with C#
Pascal Laurin
 
React workshop
Imran Sayed
 
Sécurité des Applications Web avec Json Web Token (JWT)
ENSET, Université Hassan II Casablanca
 
Kubernetes PPT.pptx
ssuser0cc9131
 
Domain Driven Design
Ryan Riley
 
Introduction to jest
pksjce
 
Bootstrap
AvinashChunduri2
 
ReactJS presentation
Thanh Tuong
 
Understanding react hooks
Samundra khatri
 
Domain Driven Design (Ultra) Distilled
Nicola Costantino
 
Domain Driven Design 101
Richard Dingwall
 
GraphQL
Joel Corrêa
 
Domain Driven Design (DDD)
Tom Kocjan
 
React js
Rajesh Kolla
 
Domain Driven Design
Nader Albert
 
Flink Forward Berlin 2017: Aris Kyriakos Koliopoulos - Drivetribe's Kappa Arc...
Flink Forward
 
How to go about testing in React?
Lisa Gagarina
 
ASP.NET Lecture 1
Julie Iskander
 
Gitlab CI : Integration et Déploiement Continue
Vincent Composieux
 
Implementing DDD with C#
Pascal Laurin
 

Viewers also liked (13)

PDF
DDD patterns that were not in the book
Cyrille Martraire
 
PDF
Architecting iOS Project
Massimo Oliviero
 
PDF
Domain-Driven Design (Artur Trosin Product Stream)
IT Arena
 
PDF
Solid principles, Design Patterns, and Domain Driven Design
Irwansyah Irwansyah
 
PDF
Domain-driven design - tactical patterns
Tom Janssens
 
PPTX
Automation of functional tests using JMeter Part II (in Polish)
Tieto Corporation
 
PPTX
Domain Driven Design in the Browser - Cameron Edwards
Hakka Labs
 
PPTX
Architecture Principles CodeStock
Steve Barbour
 
PDF
Beyond design patterns and principles - writing good OO code
Matthias Noback
 
PDF
Go-jek's Go-Food Chatbot
Irwansyah Irwansyah
 
PPTX
Why Domain-Driven Design and Reactive Programming?
VMware Tanzu
 
PPTX
Domain Driven Design Quickly
Mariam Hakobyan
 
PDF
Principles of microservices velocity
Sam Newman
 
DDD patterns that were not in the book
Cyrille Martraire
 
Architecting iOS Project
Massimo Oliviero
 
Domain-Driven Design (Artur Trosin Product Stream)
IT Arena
 
Solid principles, Design Patterns, and Domain Driven Design
Irwansyah Irwansyah
 
Domain-driven design - tactical patterns
Tom Janssens
 
Automation of functional tests using JMeter Part II (in Polish)
Tieto Corporation
 
Domain Driven Design in the Browser - Cameron Edwards
Hakka Labs
 
Architecture Principles CodeStock
Steve Barbour
 
Beyond design patterns and principles - writing good OO code
Matthias Noback
 
Go-jek's Go-Food Chatbot
Irwansyah Irwansyah
 
Why Domain-Driven Design and Reactive Programming?
VMware Tanzu
 
Domain Driven Design Quickly
Mariam Hakobyan
 
Principles of microservices velocity
Sam Newman
 
Ad

Similar to Domain-Driven Design with ASP.NET MVC (20)

PDF
Add Some DDD to Your ASP.NET MVC, OK?
Steven Smith
 
PDF
D2 domain driven-design
Arnaud Bouchez
 
PPTX
Domain Driven Design
Hannah Farrugia
 
PPTX
Seminar - Scalable Enterprise Application Development Using DDD and CQRS
Mizanur Sarker
 
PPTX
Domain Driven Design
Muhammad Ali
 
PPTX
Introducing Domain Driven Design - codemash
Steven Smith
 
PPTX
Introducing domain driven design - dogfood con 2018
Steven Smith
 
PDF
Elements of DDD with ASP.NET MVC & Entity Framework Code First
Enea Gabriel
 
ODP
Into the domain
Knoldus Inc.
 
PDF
Introduction to Domain driven design
Muhammad Ali
 
PPTX
A Practical Guide to Domain Driven Design: Presentation Slides
thinkddd
 
PDF
Clean architecture with ddd layering in php
Leonardo Proietti
 
PDF
Domain driven design and model driven development
Dmitry Geyzersky
 
PPTX
Schibsted Spain - Day 1 - DDD Course
Kevin Mas Ruiz
 
PPTX
Domain Driven Design(DDD) Presentation
Oğuzhan Soykan
 
PDF
Domain Driven Design
Mojammel Haque
 
PDF
Domain driven design: a gentle introduction
Asher Sterkin
 
PDF
Domain-Driven Design
Geeks Anonymes
 
PPTX
Domain Driven Design Belfast Meetup - Overview, Lessons and Examples by Josh ...
Russell Beggs
 
PPTX
Intro to Domain Driven Design
Yaniv Preiss
 
Add Some DDD to Your ASP.NET MVC, OK?
Steven Smith
 
D2 domain driven-design
Arnaud Bouchez
 
Domain Driven Design
Hannah Farrugia
 
Seminar - Scalable Enterprise Application Development Using DDD and CQRS
Mizanur Sarker
 
Domain Driven Design
Muhammad Ali
 
Introducing Domain Driven Design - codemash
Steven Smith
 
Introducing domain driven design - dogfood con 2018
Steven Smith
 
Elements of DDD with ASP.NET MVC & Entity Framework Code First
Enea Gabriel
 
Into the domain
Knoldus Inc.
 
Introduction to Domain driven design
Muhammad Ali
 
A Practical Guide to Domain Driven Design: Presentation Slides
thinkddd
 
Clean architecture with ddd layering in php
Leonardo Proietti
 
Domain driven design and model driven development
Dmitry Geyzersky
 
Schibsted Spain - Day 1 - DDD Course
Kevin Mas Ruiz
 
Domain Driven Design(DDD) Presentation
Oğuzhan Soykan
 
Domain Driven Design
Mojammel Haque
 
Domain driven design: a gentle introduction
Asher Sterkin
 
Domain-Driven Design
Geeks Anonymes
 
Domain Driven Design Belfast Meetup - Overview, Lessons and Examples by Josh ...
Russell Beggs
 
Intro to Domain Driven Design
Yaniv Preiss
 
Ad

More from Steven Smith (20)

PPTX
Clean architecture with asp.net core by Ardalis
Steven Smith
 
PDF
Finding Patterns in the Clouds - Cloud Design Patterns
Steven Smith
 
PPTX
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
Steven Smith
 
PPTX
Most Useful Design Patterns
Steven Smith
 
PPTX
Improving the Design of Existing Software
Steven Smith
 
PPTX
Introducing ASP.NET Core 2.0
Steven Smith
 
PPTX
Decoupling with Domain Events
Steven Smith
 
PPTX
Improving the Quality of Existing Software
Steven Smith
 
PPTX
Improving the Quality of Existing Software
Steven Smith
 
PPTX
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016
Steven Smith
 
PPTX
Improving the Quality of Existing Software - DevIntersection April 2016
Steven Smith
 
PPTX
Breaking Dependencies to Allow Unit Testing
Steven Smith
 
PPTX
Improving the Quality of Existing Software
Steven Smith
 
PPTX
A Whirldwind Tour of ASP.NET 5
Steven Smith
 
PPTX
Domain events
Steven Smith
 
PPTX
My Iraq Experience
Steven Smith
 
PDF
Breaking Dependencies to Allow Unit Testing
Steven Smith
 
PPTX
Improving The Quality of Existing Software
Steven Smith
 
PPTX
Refactoring with SOLID Principles (FalafelCon 2013)
Steven Smith
 
PPTX
Common ASP.NET Design Patterns - Telerik India DevCon 2013
Steven Smith
 
Clean architecture with asp.net core by Ardalis
Steven Smith
 
Finding Patterns in the Clouds - Cloud Design Patterns
Steven Smith
 
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
Steven Smith
 
Most Useful Design Patterns
Steven Smith
 
Improving the Design of Existing Software
Steven Smith
 
Introducing ASP.NET Core 2.0
Steven Smith
 
Decoupling with Domain Events
Steven Smith
 
Improving the Quality of Existing Software
Steven Smith
 
Improving the Quality of Existing Software
Steven Smith
 
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016
Steven Smith
 
Improving the Quality of Existing Software - DevIntersection April 2016
Steven Smith
 
Breaking Dependencies to Allow Unit Testing
Steven Smith
 
Improving the Quality of Existing Software
Steven Smith
 
A Whirldwind Tour of ASP.NET 5
Steven Smith
 
Domain events
Steven Smith
 
My Iraq Experience
Steven Smith
 
Breaking Dependencies to Allow Unit Testing
Steven Smith
 
Improving The Quality of Existing Software
Steven Smith
 
Refactoring with SOLID Principles (FalafelCon 2013)
Steven Smith
 
Common ASP.NET Design Patterns - Telerik India DevCon 2013
Steven Smith
 

Recently uploaded (20)

PDF
Online Queue Management System for Public Service Offices in Nepal [Focused i...
Rishab Acharya
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
PPTX
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
PPTX
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
PPTX
Coefficient of Variance in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PDF
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
PPTX
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
DOCX
Import Data Form Excel to Tally Services
Tally xperts
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PPTX
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
PPTX
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
PPTX
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PDF
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
Online Queue Management System for Public Service Offices in Nepal [Focused i...
Rishab Acharya
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
Coefficient of Variance in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Import Data Form Excel to Tally Services
Tally xperts
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 

Domain-Driven Design with ASP.NET MVC