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

Should domain objects have dependencies injected into them?

I'm specifically referring to this question: DDD - How to implement factories The selected answer has stated: "factories should not be tied with dependency injection because domain objects shouldn't have dependencies injected into them." My question…
n3wb
  • 1,037
  • 5
  • 12
  • 20
24
votes
8 answers

TDD, DDD and Encapsulation

After several years of following the bad practice handed down from 'architects' at my place of work and thinking that there must be a better way, I've recently been reading up around TDD and DDD and I think the principles and practices would be a…
Justin
  • 564
  • 4
  • 13
23
votes
3 answers

Is this really DDD?

I am 80% sure I should not be asking this question because it might come across as negative and I mean no disrespect to anyone, especially the author of this book. I have seen several posts recommending this book and its companion project. I have…
n8wrl
  • 19,439
  • 4
  • 63
  • 103
23
votes
3 answers

How do read-only database views fit into the repository pattern?

Example: Your database has a SQL view named "CustomerOrdersOnHold". This view returns a filtered mix of specific customer and order data fields. You need to fetch data from this view in your application. How does access to such a view fit into the…
23
votes
4 answers

.NET DDD Example

Can somebody point me towards a 'complete' DDD example developed on the .NET platform. Most of the examples I find feel 'incomplete'. I'd really like to see the DDD principles in action.
Ali Kazmi
  • 3,610
  • 6
  • 35
  • 51
23
votes
5 answers

Should my Domain Exceptions be thrown from Application Layer?

I'm reading Vaughn Vernon Book - Implementing Domain Driven Design. There is an example of a Project Management Application. There are aggregates like BacklogItem, Sprint, etc. If I have BacklogItemNotFoundException defined in Domain layer. Should…
DmitriBodiu
  • 1,120
  • 1
  • 11
  • 22
23
votes
2 answers

How to pass Current User Information to all Layers in DDD

Similar questions have been asked before but not quite the same (unless I missed it) I want to pass IUserInfo class instance through my Service, Domain , Domain Events, Domain Event Handlers... Whats is the best way to do it. Should I Inject it…
TheMar
  • 1,934
  • 2
  • 30
  • 51
23
votes
2 answers

Object reference vs reference by Id in DDD Aggregates

In the Pluralsight course Domain-Driven Design Fundamentals, there's an example of how the design of an Aggregate takes shape. The example involves patient Appointments in a clinic. The appointment has relations e.g. to a doctor, or an exam…
Manolo
  • 1,597
  • 4
  • 21
  • 35
23
votes
3 answers

How to deal with value objects in Entity Framework?

How do I persist value objects in Entity Framework without polluting my domain model? EF (well, relational DBs in general) require me to define a key - which my value objects don't have out of the box, for example public class Tag :…
Thorsten Westheider
  • 10,572
  • 14
  • 55
  • 97
23
votes
3 answers

When we shouldn't use Domain-Driven Design approach?

I've been reading about DDD that I faced with this paragraph For data centric operations you would probably be better off using something like an Active Record pattern, or even a DAL over stored procedures. You may find some benefits in some of…
Masoud Sedghi
  • 495
  • 1
  • 6
  • 19
23
votes
4 answers

Service Oriented Architecture & Domain-Driven Design

I've always developed code in a SOA type of way. This year I've been trying to do more DDD but I keep getting the feeling that I'm not getting it. At work our systems are load balanced and designed not to have state. The architecture…
null_pointer
  • 1,779
  • 4
  • 19
  • 38
22
votes
3 answers

DDD and implementing persistence

I am getting my feet wet with DDD (in .Net) for the first time, as I am re-architecting some core components of a legacy enterprise application. Something I want to clear up is, how do we implement persistence in a proper DDD architecture? I realize…
EkoostikMartin
  • 6,831
  • 2
  • 33
  • 62
22
votes
2 answers

Sending an e-mail or SMS using CQRS and domain-driven-design

At this moment we are building a new architecture that is based on the principles of CQRS and domain-driven-design. We are now having some discussions about how we should deal with external communication. To make the question more concrete I use the…
llMll
  • 495
  • 4
  • 9
22
votes
3 answers

Event Sourcing and optimistic concurrency control

When you want code works under race conditions, commonly developers uses Optimistic concurrency control (OCC). From Wikipedia: ...before committing, each transaction verifies that no other transaction has modified the data it has read. If the…
22
votes
4 answers

CQRS Event Sourcing check username is unique or not from EventStore while sending command

EventSourcing works perfectly when we have particular unique EntityID but when I am trying to get information from eventStore other than particular EntityId i am having tough time. I am using CQRS with EventSourcing. As part of event-sourcing we…
Roshan
  • 873
  • 12
  • 33