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

DDD: Where to keep domain Interfaces, the Infrastructure?

Does it make sense to group all Interfaces of your Domain Layer (Modules, Models, Entities, Domain Services, etc) all within the Infrastructure layer? If not, does it make sense to create a "shared" project/component that groups all of these into…
eduncan911
  • 17,165
  • 13
  • 68
  • 104
25
votes
11 answers

Choosing between immutable objects and structs for value objects

How do you choose between implementing a value object (the canonical example being an address) as an immutable object or a struct? Are there performance, semantic or any other benefits of choosing one over the other?
Garry Shutler
  • 32,260
  • 12
  • 84
  • 119
25
votes
2 answers

Should domain events be raised within or outside of a transaction?

In our application we raise domain events when something changes in the domain model. Some of the tasks that are performed by the event handlers must be done within the same transaction that was used when the event is raised, other tasks must be…
Andronicus
  • 1,799
  • 1
  • 14
  • 28
25
votes
7 answers

Domain-driven-design (DDD) pitfalls

I am quite new with DDD and would like to know about any pitfalls you might want to share. I will summarize it later for more newbies to read :) Thanks Summary so far: Anemic domain model where your entities are primarily only data bearing and…
Piotr
  • 4,813
  • 7
  • 35
  • 46
25
votes
3 answers

Using MVVM and DDD in WPF application without having too many classes

I have a WPF application where I want to apply MVVM for the presentation layer and DDD for the whole application. I am very confused with how I should apply the architecture. Can you give me some advises as it feels like I have completely messed up…
U. Bulle
  • 1,075
  • 9
  • 20
25
votes
3 answers

Should I abstract the validation framework from Domain layer?

I am using FluentValidation to validate my service operations. My code looks like: using FluentValidation; IUserService { void Add(User user); } UserService : IUserService { public void Add(User user) { new…
25
votes
13 answers

Clean OO-structure vs. SQL performance

When programming in PHP I always try to create meaningful 'models' (classes) that correspond to tables in the database. I often encounter the following problem: Assuming that I've created a database with two tables: authors and blogs, which both…
Thijs
  • 568
  • 6
  • 16
24
votes
2 answers

Should value object hold reference to entity?

Should value object hold reference to entity in DDD methodology? EDIT @Dmitry: This is probably my case. Here I attach class diagram where the Account hold references to collection of IInvoiceable items. I treat with Tenant as entity, but it owns…
Ivan
  • 1,254
  • 12
  • 25
24
votes
2 answers

Onion Architecture

I am setting up a project structure for an upcoming internal application trialling the Onion Architecture proposed by Palermo (http://jeffreypalermo.com/blog/the-onion-architecture-part-3/). I have followed his guidelines, however I need some…
Darbio
  • 11,286
  • 12
  • 60
  • 100
24
votes
2 answers

Many-to-many relationships in DDD

I'm new to DDD and I'm stuck with many-to-many relationships. E.g. we have two aggregate roots - Tasks and Workers. Contract is definitely not aggregate root, because it has no sense without Task and Worker. So, it should be part of some aggregate.…
Sergey Berezovskiy
  • 232,247
  • 41
  • 429
  • 459
24
votes
4 answers

Validation in Domain Driven Design

Our team is starting a new project following Domain Driven Design (DDD). At the high level, we have an API on the top of our domain which enables a client to perform operations on the domain. One of the question I'm not very clear about is where do…
Ankit Vijay
  • 3,752
  • 4
  • 30
  • 53
24
votes
3 answers

Can aggregate root reference another root?

I'm a little bit confused. I just watched Julie Lerman's Pluralsight video on DDD and here's the confusion I have: Having a simple online store example with: Purchase Orders with Items for Suppliers, what's the aggregate root here? Technically…
24
votes
3 answers

Repository Pattern without an ORM

I am using repository pattern in a .NET C# application that does not use an ORM. However the issue I am having is how to fill One-to-many List properties of an entity. e.g. if a customer has a list of orders i.e. if the Customer class has a List…
nabeelfarid
  • 4,156
  • 5
  • 42
  • 60
24
votes
1 answer

DTO shape: flat, complex/nested, or a mixture of both

I have an MVC2 n-tier application (DAL, Domain, Service, MVC web) using a DDD approach (Domain Driven Design), having a Domain Model with repositories. My service layer uses a Request/Response pattern, in which the Request and Response objects…
tbehunin
  • 1,043
  • 1
  • 12
  • 24
24
votes
3 answers

Does Repository pattern kills ORM?

Besides translating Relational data to Object model, The ORM has other roles, as: Lazy Loading Automatic change detection Transactions However, with Repository pattern translating ORM's DTOs to Domain Models, that happens: Can't use the…
Wagner Leonardi
  • 4,226
  • 2
  • 35
  • 41