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: Domain-Driven Design: Tackling Complexity in the Heart of Software

Books

Sample Application

6728 questions
18
votes
1 answer

Is there a mismatch between Domain-Driven Design repositories and Spring Data ones?

DDD specifies repository per aggregate, but when embracing Spring Data JPA, we can leverage the benefits only when we declare interface per entity. How this impedance mismatch can be resolved? I'm hoping to try out repository interfaces encapsulated…
18
votes
5 answers

Why the domain model should not be used as resources in REST API?

I came across a statement that the domain model designed in accordance with DDD should not be used as resources in a REST API (source). It is clear that a REST API is a contract of the application while the domain model is part of the…
Adam Siemion
  • 15,569
  • 7
  • 58
  • 92
18
votes
2 answers

DDD repository and factory

In my application a few layers. In this topic will focus on Domain and Infrastructure layers. I have repository interface ClientRepositoryInterface in Domain layer. And I have implementation of this interface ClientRepositoryImpl in Infrastructure…
18
votes
5 answers

Am I allowed to have "incomplete" aggregates in DDD?

DDD states that you should only ever access entities through their aggregate root. So say for instance that you have an aggregate root X which potentially has a lot of child Y entities. Now, for some scenario, you only really care about a subset of…
Fredrik Kalseth
  • 13,934
  • 4
  • 25
  • 17
18
votes
4 answers

How to model bank transfer in CQRS

I'm reading Accounting Pattern and quite curious about implementing it in CQRS. I think AccountingTransaction is an aggregate root as it protects the invariant: No money leaks, it should be transfer from one account to another. public class…
Yugang Zhou
  • 7,123
  • 6
  • 32
  • 60
18
votes
3 answers

Can we use ASP.NET Identity in Domain Driven Design?

Our team decided to use Domain Driven Design architecture for our project. Now the discussion is going on for, "can we use ASP.NET Identity in DDD?". Is there any disadvantages on using ASP.NET identity in DDD design. I'm in a confusion to make a…
RajeshKannan
  • 894
  • 2
  • 16
  • 32
18
votes
2 answers

How To Implement The Query Side Of CQRS in DDD?

I have implemented the command side of DDD using the domain model and repositories, but how do I implement the query side? Do I create an entirely new domain model for the UI, and where is this kept in the project structure...in the domain layer,…
Laz
  • 3,474
  • 9
  • 33
  • 46
18
votes
5 answers

Gave up DDD, but need some of its benefits

I'm giving up traditional DDD, which is often a massive timewaster, and forces me to do endless mapping: data layer <--> domain layer <--> presentation layer. For even a small change I must change data models, domain models, presentation models /…
Bobby B
  • 2,287
  • 2
  • 24
  • 47
18
votes
4 answers

Rich domain model with behaviours and ORM

After watching NDC12 presentation "Crafting Wicked Domain Models" from Jimmy Bogard (http://ndcoslo.oktaset.com/Agenda), I was wandering how to persist that kind of domain model. This is sample class from presentation: public class Member { …
Hrvoje Hudo
  • 8,994
  • 5
  • 33
  • 42
18
votes
4 answers

Proper way of creating child entities with DDD

I'm fairly new to DDD world and after reading couple of books about it (Evans DDD among them) I was unable to find the answer to my question on internet: what the proper way of creating child entities with DDD? You see, a lot of information on…
Michael Logutov
  • 2,551
  • 4
  • 28
  • 32
17
votes
6 answers

DDD, value objects and ORM

Value objects do not have identity. ORM needs identity to update the database. How to trick ORM? (Marking Id for value object as internal won't work because ORM lives in a different assembly and moving it to the same assembly is not…
Arnis Lapsa
  • 45,880
  • 29
  • 115
  • 195
17
votes
6 answers

DDD - Dependencies between domain model, services and repositories

Just wanted to know how others have layered their architecture. Say I have my layers as follows: Domain Layer --Product --ProductService (Should the imp go into this layer?) --IProductService --IProductRepository Infrastructure…
Th3Fix3r
17
votes
3 answers

Immutable Value objects and JPA

Is there way to map immutable Value objects like email address using JPA? @Immutable @Embeddable public final class EmailAddress { private final String value; public EmailAddress(String value) { this.value = value; } public…
Stan Kurilin
  • 15,614
  • 21
  • 81
  • 132
17
votes
6 answers

How can I resolve the conflict between loose coupling/dependency injection and a rich domain model?

Edit: This is not a conflict on the theoretical level but a conflict on an implementation level. Another Edit: The problem is not having domain models as data-only/DTOs versus richer, more complex object map where Order has OrderItems and some…
Robert Campbell
  • 6,848
  • 12
  • 63
  • 93
17
votes
2 answers

Can DTO's have nested DTO's?

I have the following domain model: public class Playlist { public long Id { get; set; } public string Title { get; set; } public virtual ICollection Songs { get; set; } } public class Song { public long Id { get; set; } …