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
35
votes
6 answers

Where to raise persistence-dependent domain events - service, repository, or UI?

My ASP.NET MVC3 / NHibernate application has a requirement to fire off and handle a variety of events related to my domain objects. For example, an Order object might have events like OrderStatusChanged or NoteCreatedForOrder. In most cases these…
35
votes
3 answers

Event Sourcing and Read Model generation

Assuming Stack Overflow domain problem and the following definition of events: UserRegistered(UserId, Name, Email) UserNameChanged(UserId, Name) QuestionAsked(UserId, QuestionId, Title, Question) Assuming the following state of event store (in the…
Dmitry Schetnikovich
  • 1,752
  • 17
  • 26
35
votes
4 answers

How to handle set based consistency validation in CQRS?

I have a fairly simple domain model involving a list of Facility aggregate roots. Given that I'm using CQRS and an event-bus to handle events raised from the domain, how could you handle validation on sets? For example, say I have the following…
35
votes
4 answers

DDD Infrastructure services

I am learning DDD and I am a little bit lost in the Infrastructure layer. As I understand, "all good DDD applications" should have 4 layers: Presentation, Application, Domain, and Infrastructure. The database should be accessed using Repositories.…
Zygimantas
  • 8,547
  • 7
  • 42
  • 54
34
votes
7 answers

What Belongs to the Aggregate Root

This is a practical Domain Driven Design question: Conceptually, I think I get Aggregate roots until I go to define one. I have an Employee entity, which has surfaced as an Aggregate root. In the Business, some employees can have work-related…
jlembke
  • 13,217
  • 11
  • 42
  • 56
34
votes
2 answers

What is the difference between Invariants and Validation Rules?

I often see the term Invariants in DDD. Here Dino Esposito talks about it. If I look at the .NET library, I see a ValidationAttribute class. Are Invariants and validation rules the same? For example, can I say 50% discount is available only if the…
wonderful world
  • 10,969
  • 20
  • 97
  • 194
34
votes
8 answers

Mapping Validation Attributes From Domain Entity to DTO

I have a standard Domain Layer entity: public class Product { public int Id { get; set; } public string Name { get; set; } public decimal Price { get; set;} } which has some kind of validation attributes applied: public class…
Martin Suchanek
  • 3,006
  • 6
  • 31
  • 31
33
votes
5 answers

How to Organise a Domain Driven Design Project?

I've started learning about DDD and wanted to know how others have organised their projects. I've started off by organising around my AggregateRoots: MyApp.Domain (namespace for domain model) MyApp.Domain.Product - Product - IProductService -…
Th3Fix3r
33
votes
5 answers

Domain Driven Design disadvantages?

I might have a silly question about DDD: Are there any disadvatages of DDD generraly? I mean, besides of using it when it is not necessary, or needed. (e.g. small/not complex projets) Thanks
Peter
  • 331
  • 1
  • 3
  • 3
33
votes
5 answers

What is an example of a task based UI?

My team has been "tasked" to create an application that follows the task-based UI (not necessarily with CQRS). I really like a UI that helps the user accomplish common tasks easily, but many pieces of this application really "feel" (to me) like a…
Byron Sommardahl
  • 12,743
  • 15
  • 74
  • 131
33
votes
5 answers

MVVM: Binding to Model while keeping Model in sync with a server version

I've spent quite some time to try and find an elegant solution for the following challenge. I've been unable to find a solution that's more than a hack around the problem. I've got a simple setup of a View, ViewModel and a Model. I will keep it very…
ndsc
  • 1,173
  • 2
  • 13
  • 22
32
votes
5 answers

Is it ok for entities to access repositories?

I've just started working with DDD, so maybe this is a silly question... Is it ok for an entity to access a repository (via some IRepository interface) to get a value at runtime? For example, I want to enforce a "default" selection for a…
32
votes
5 answers

C# MongoDB: How to correctly map a domain object?

I recently started reading Evans' Domain-Driven design book and started a small sample project to get some experience in DDD. At the same time I wanted to learn more about MongoDB and started to replace my SQL EF4 repositories with MongoDB and the…
hoetz
  • 2,368
  • 4
  • 26
  • 58
32
votes
6 answers

Design Methodology: use case driven vs. domain driven

Just for discussion, to me it seems that 2 different terminologies actually are saying the same thing. Is there any tangible differences between this 2 design approaches?
zs2020
  • 53,766
  • 29
  • 154
  • 219
31
votes
3 answers

DDD Using Specification pattern for Validation

I am thinking of using Specification pattern for validation purposes. The hard thing is how to tell the user why some Specification was not satisfied. What if the Specification.IsSatisfiedBy() will not only return a bool value, but also the reason…
Markus
  • 3,547
  • 10
  • 39
  • 55