Questions tagged [domain-driven-design]

Domain-driven design (DDD) is an approach to developing software for complex needs by deeply connecting the implementation to an evolving model of the core business concepts. Note that conceptual DDD questions are better to be asked at softwareengineering.stackexchange.com.

The premise of domain-driven design is the following:

  • Placing the project's primary focus on the core domain and domain logic
  • Basing complex designs on a model
  • Initiating a creative collaboration between technical and domain experts to iteratively cut ever closer to the conceptual heart of the problem.

Domain-driven design is not a technology or a methodology. DDD provides a structure of practices and terminology for making design decisions that focus and accelerate software projects dealing with complicated domains.

The term was coined by Eric Evans in his book of the same title.

Books

Sample Application

5861 questions
478
votes
12 answers

What is the difference between DAO and Repository patterns?

What is the difference between Data Access Objects (DAO) and Repository patterns? I am developing an application using Enterprise Java Beans (EJB3), Hibernate ORM as infrastructure, and Domain-Driven Design (DDD) and Test-Driven Development (TDD) as…
403
votes
7 answers

Where do I find some good examples for DDD?

I'm learning about Domain Driven Design, however there are some practical issues that are confusing to me that I think seeing some good samples might clear up. Does anyone know of some good working code samples that do a good job of modelling basic…
jlembke
  • 12,044
  • 10
  • 40
  • 56
310
votes
8 answers

Domain Driven Design: Domain Service, Application Service

Can someone explain the difference between domain and application services by providing some examples? And, if a service is a domain service, would I put the actual implementation of this service within the domain assembly and if so, would I also…
Chris
  • 6,431
  • 4
  • 38
  • 57
296
votes
2 answers

What is Domain Driven Design (DDD)?

I keep seeing DDD (Domain Driven Design) being used a lot in articles - I have read the Wikipedia entry about DDD but still can't figure out what it actually is and how I would go about implementing it in creating my sites?
leen3o
  • 8,636
  • 22
  • 72
  • 117
210
votes
9 answers

Should services always return DTOs, or can they also return domain models?

I'm (re)designing large-scale application, we use multi-layer architecture based on DDD. We have MVC with data layer (implementation of repositories), domain layer (definition of domain model and interfaces - repositories, services, unit of work),…
207
votes
8 answers

What is Domain Driven Design?

Can somebody please explain (in succinct terms) what exactly is domain driven design? I see the term quite a lot but really don't understand what it is or what it looks like. How does it differ from non-domain driven design? Also, can somebody…
Calanus
  • 23,416
  • 24
  • 77
  • 118
200
votes
12 answers

DDD - the rule that Entities can't access Repositories directly

In Domain Driven Design, there seems to be lots of agreement that Entities should not access Repositories directly. Did this come from Eric Evans Domain Driven Design book, or did it come from elsewhere? Where are there some good explanations for…
codeulike
  • 20,946
  • 27
  • 113
  • 161
112
votes
9 answers

DTO = ViewModel?

I'm using NHibernate to persist my domain objects. To keep things simple I'm using an ASP.NET MVC project as both my presentation layer, and my service layer. I want to return my domain objects in XML from my controller classes. After reading some…
autonomatt
  • 4,125
  • 4
  • 25
  • 36
100
votes
9 answers

Value vs Entity objects (Domain Driven Design)

I have just started reading DDD. I am unable to completely grasp the concept of Entity vs Value objects.. Can someone please explain the problems (maintainability, performance.. etc) a system could face when a Value object is designed as a Entity…
StackUnderflow
88
votes
5 answers

What is the difference between domain objects, POCOs and entities?

I was under the impression they are all basically the same. Are model objects also the same? Right now, in my architecture, I have: class Person { public string PersonId; public string Name; public string Email; public…
jpshook
  • 4,516
  • 6
  • 34
  • 44
87
votes
4 answers

How to map View Model back to Domain Model in a POST action?

Every article found in the Internet on using ViewModels and utilizing Automapper gives the guidelines of the "Controller -> View" direction mapping. You take a domain model along with all Select Lists into one specialized ViewModel and pass it to…
86
votes
14 answers

Why should I isolate my domain entities from my presentation layer?

One part of domain-driven design that there doesn't seem to be a lot of detail on, is how and why you should isolate your domain model from your interface. I'm trying to convince my colleagues that this is a good practice, but I don't seem to be…
84
votes
5 answers

Reducing Repositories to Aggregate Roots

I currently have a repository for just about every table in the database and would like to further align myself with DDD by reducing them to aggregate roots only. Let’s assume that I have the following tables, User and Phone. Each user might have…
e36M3
  • 5,494
  • 4
  • 33
  • 47
80
votes
6 answers

Confused about Bounded Contexts and SubDomains

I've read Eric Evan's book and am reading Vaughn Vernon's book now. I'm in the second chapter where he talks about subdomains and bounded context and am thoroughly confused now. From what I was able to distill, there should be a 1:1 relationship…
Chris
  • 1,310
  • 1
  • 13
  • 23
79
votes
8 answers

CQRS Event Sourcing: Validate UserName uniqueness

Let's take a simple "Account Registration" example, here is the flow: User visit website Click "Register" button and fill form, click "Save" button MVC Controller: Validate UserName uniqueness by reading from ReadModel RegisterCommand: Validate…
Mouhong Lin
  • 4,082
  • 4
  • 30
  • 47
1
2 3
99 100