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
47
votes
2 answers

How do Repositories fit with CQRS?

According to Fowler (here), a repository "mediates between the domain and data mapping layers, acting like an in-memory domain object collection." So, for example, in my Courier Service application, when a new run is submitted, my application…
SonOfPirate
  • 5,642
  • 3
  • 41
  • 97
46
votes
5 answers

Is it problematic that Spring Data REST exposes entities via REST resources without using DTOs?

In my limited experience, I've been told repeatedly that you should not pass around entities to the front end or via rest, but instead to use a DTO. Doesn't Spring Data Rest do exactly this? I've looked briefly into projections, but those seem to…
45
votes
1 answer

Domain Driven Design - how the layers should be organized?

I'm very much new to software development. I think layered architecture is a great way to reduce the complexities that arise in the process of object oriented software development and, not to mention, to keep your code organized. I'm interested to…
45
votes
6 answers

Value objects in DDD - Why immutable?

I don't get why value objects in DDD should be immutable, nor do I see how this is easily done. (I'm focusing on C# and Entity Framework, if that matters.) For example, let's consider the classic Address value object. If you needed to change "123…
Hobbes
  • 451
  • 1
  • 4
  • 4
45
votes
6 answers

Why does domain driven design seem only popular with static languages like C# & Java?

Domain driven design has become my architecture of choice. I've been able to find a abundance of books & tutorials for applying DDD principles within the ASP.net framework. It mostly seems inspired from what Java developers have been doing for a…
srmark
  • 7,942
  • 13
  • 63
  • 74
45
votes
3 answers

What is the relationship between DDD and the “Onion Architecture”?

What is the relationship between Domain-driven design (DDD) and "The Onion Architecture" of Jeffrey Palermo?
ulrichb
  • 19,610
  • 8
  • 73
  • 87
45
votes
3 answers

DAO, Repositories and Services in DDD

After reading several articles, I am starting to understand the difference between DAO and Repositories, but I find myself in trouble trying to understand the difference between Repositories and Services. For putting in short terms, in the OO…
Victor
  • 3,841
  • 2
  • 37
  • 63
43
votes
2 answers

Decompose microservices: Business capability vs Domain

As I read, there are two patterns to define one microservice, by business capability and by subdomain. But I still find it very ambiguous. I get confused how these two patterns differentiate from each other. Both of them revolve around activities…
necroface
  • 3,365
  • 10
  • 46
  • 70
42
votes
3 answers

How do integrate "Users" in my DDD model with authenticating users?

I'm creating my first ASP.NET MVC site and have been trying to follow domain driven development. My site is a project collaboration site where users can be assigned to one or more projects on the site. Tasks are then added to projects, and users…
Eric Anastas
  • 21,675
  • 38
  • 142
  • 236
42
votes
5 answers

Value Objects in CQRS - where to use

Let's say we have CQRS-inspired architecture, with components such as Commands, Domain Model, Domain Events, Read Model DTOs. Of course, we can use Value Objects in our Domain Model. My question is, should they also be used…
driushkin
  • 3,531
  • 1
  • 24
  • 25
42
votes
4 answers

CQRS and Event Sourcing Difference

What is the difference between CQRS (Command Query Responsibility Segregation) and Event Sourcing? I believe Event Sourcing is a type of CQRS. What distinguishes each, and what makes Event Sourcing different from other types of CQRS? Thanks,
user8280126
42
votes
4 answers

Repository Pattern: how to Lazy Load? or, Should I split this Aggregate?

I have a domain model that has the concept of an Editor and a Project. An Editor owns a number of Projects, and a Project has not only an Editor owner, but also a number of Editor members. Therefore, an Editor also has a number of "joined"…
42
votes
3 answers

Django and domain driven design

I am confused about Domain Driven Design Approaches. From the sources on net I understood it is way of segregating your Domain Objects and Database Objects but I don't understand the difference between two. For an example lets take the code of…
Anubhav Agarwal
  • 1,982
  • 5
  • 28
  • 40
42
votes
2 answers

DDD: do I really need to load all objects in an aggregate? (Performance concerns)

In DDD, a repository loads an entire aggregate - we either load all of it or none of it. This also means that should avoid lazy loading. My concern is performance-wise. What if this results in loading into memory thousands of objects? For example,…
user11081980
  • 3,059
  • 4
  • 30
  • 48
42
votes
4 answers

What's the difference between Data Modelling and Domain Modelling?

By the way - with reference to data modelling I'm referring to logical or conceptual data models - not physical ones. The question came up during a discussion at work; naturally I leapt to Wikipedia to get some basic definitions in place - hoping…
Adrian K
  • 9,880
  • 3
  • 33
  • 59