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
42
votes
3 answers

Relation between command handlers, aggregates, the repository and the event store in CQRS

I'd like to understand some details of the relations between command handlers, aggregates, the repository and the event store in CQRS-based systems. What I've understood so far: Command handlers receive commands from the bus. They are responsible…
Golo Roden
  • 140,679
  • 96
  • 298
  • 425
41
votes
2 answers

DDD, Anti Corruption layer, how-to?

At the moment, we have to build an application which is based on a legacy one. Code for that old application should be thrown away and rewritten, but as it usually goes - instead of rewriting it, we need to base something new on it. Recently, we…
Arnis Lapsa
  • 45,880
  • 29
  • 115
  • 195
41
votes
3 answers

What are the benefits of Persistence Ignorance?

I am a newbie in the DDD+TDD World. But I have been in programming for almost 9 years. Can someone please explain me the benefits of persistance ignornace ? Typical nHibernate application just pushes the dependency between class and database to…
cbrcoder
  • 530
  • 1
  • 4
  • 8
41
votes
1 answer

Alternatives to many-to-many relationships with CQRS

How do we model classic many-to-many relationships with CQRS/DDD? I know that both DDD and CQRS implementations and solutions tend to be domain-specific, so it may be difficult to come up with a general answer to this question. However, let's assume…
Mark Seemann
  • 225,310
  • 48
  • 427
  • 736
41
votes
1 answer

Difference between specification and a policy?

I am reading the brilliant book "Domain Driven Design" written by Eric Evans. In his book Eric describes two different concepts: the specification pattern and policies. Here is an example for a specification: public interface ProjectSpecification…
MUG4N
  • 19,377
  • 11
  • 56
  • 83
40
votes
2 answers

Why always have single implementation interfaces in service and dao layers?

I've worked/seen a few spring-hibernate web application projects having as many interfaces as there are actual service and dao classes. I always thought that these two as the main reasons for having these single implementation interfaces: Spring…
haps10
  • 3,496
  • 6
  • 32
  • 38
39
votes
3 answers

Domain Driven Design in Node.js Application

TL; DR; I'm looking for trite example of DDD node.js application. Hi, I'm going to create node application. I wonder that I can not find any example of application with business logic separated in domain. OK, there are some examples…
Dawid Dominiak
  • 497
  • 2
  • 7
  • 11
39
votes
4 answers

Specification Pattern in Domain Driven Design

I've been struggling around a DDD-related issue with Specifications and I've read much into DDD and specifications and repositories. However, there is an issue if trying to combine all 3 of these without breaking the domain-driven design. It boils…
Tseng
  • 61,549
  • 15
  • 193
  • 205
39
votes
4 answers

Advice on mapping of entities to domain objects

I'm currently working in a project where we are starting to build an application using a DDD approach. We are now looking into using Entity Framework 6 code first to help us with data persistence. My question is how to best handle data mapping…
mstrand
  • 2,973
  • 5
  • 24
  • 26
39
votes
7 answers

Best way to implement Repository Pattern?

I've been exploring BDD/DDD and as a consequence trying to come up with a proper implementation of the Repository pattern. So far, it's been hard to find a consensus over the best way to implement this. I've tried to boil it down to the following…
Michael Cook
  • 1,676
  • 2
  • 26
  • 47
39
votes
2 answers

MVVM: Modified model, how to correctly update ViewModel and View?

Case Say I have a Person class, a PersonViewModel and a PersonView. Updating properties from PersonView to the Person model is simple enough. PersonViewModel contains a Person object and has public properties the PersonView binds to in order to…
ndsc
  • 1,173
  • 2
  • 13
  • 22
38
votes
6 answers

Communicating between two Bounded Contexts in DDD

I have few different Bounded Contexts in the domain. The validation of a CRUD operation is built in each Bounded Context. For example, I can create an entity called GAME only if the person creating it is a Group Leader. I have two Bounded Contexts…
wonderful world
  • 10,969
  • 20
  • 97
  • 194
37
votes
7 answers

Onion Architecture - Repository Vs Service?

I am learning the well-known Onion Architecture from Jeffrey Palermo. Not specific to this pattern, but I cannot see clearly the separation between repositories and domain services. I (mis)understand that repository concerns data access and service…
Cybermaxs
  • 24,378
  • 8
  • 83
  • 112
36
votes
8 answers

Are persistence annotations in domain objects a bad practice?

I realize that persistence frameworks such as Morphia and Hibernate rely on annotations on domain objects to do their magic. At some level, it seems to me that this is inserting persistence concerns into the domain layer which is something we're…
HolySamosa
  • 9,011
  • 14
  • 69
  • 102
35
votes
1 answer

Repository Pattern with Entity Framework 4.1 and Parent/Child Relationships

I still have some confusion with the Repository Pattern. The primary reason why I want to use this pattern is to avoid calling EF 4.1 specific data access operations from the domain. I'd rather call generic CRUD operations from a IRepository…