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

Difference between an entity and an aggregate in domain driven design

Please what is the main difference between entities and aggregate roots in domain driven design. For example in entity framework, what is the use of aggregates if I can ensure data integrity entities?
D_Edet
  • 691
  • 1
  • 8
  • 13
59
votes
7 answers

Transactions in the Repository Pattern

How do I encapsulate the saving of more than one entity in a transactional manner using the repository pattern? For example, what if I wanted to add an order and update the customer status based on that order creation, but only do so if the order…
59
votes
9 answers

CQRS Examples and Screencasts

I'm looking for some in depth end-to-end CQRS examples with a reasonable set of unit tests. Also, if anyone knows of some CQRS screencasts as well it would be extremely handy. I'm already aware of these examples CQRS Info Super Simple CQRS
Tom Dudfield
  • 3,077
  • 2
  • 25
  • 39
54
votes
3 answers

How does a service layer fit into my repository implementation?

I have created a POCO model class and a repository class which handles persistence. Since the POCO cannot access the repository, there are lots of business logic tasks in the repository which doesn't seem right. From what I have read, it looks…
jpshook
  • 4,834
  • 6
  • 36
  • 45
54
votes
4 answers

Domain Driven Design vs Model Driven Architecture

I am curious, what are the differences between Domain Driven Design and Model Driven Architecture? I have the impression they have certain similarities. Could you enlighten me? Thanks
DaJackal
  • 2,085
  • 4
  • 32
  • 48
54
votes
16 answers

Is non-programmatic software development feasible?

I'm currently faced with a very unusual design problem, and hope that a developer wiser than myself might be able to offer some insight. Background Without being too specific, I've been hired by a non-profit organisation to assist with the…
Bayard Randel
  • 9,930
  • 3
  • 42
  • 46
54
votes
6 answers

Repository pattern and mapping between domain models and Entity Framework

My repositories deal with and provide persistence for a rich domain model. I do not want to expose the anemic, Entity Framework data entity to my business layers, so I need some way of mapping between them. In most cases, constructing a domain…
52
votes
5 answers

What is a practical way to model lookup tables in Domain Driven Design (DDD)?

I'm just learning DDD (Eric Evans book is open in front of me) and I've come across a problem that I can't find an answer for. What do you do in DDD when you're just trying to get a simple list of lookup records? Ex. EmployeeID: 123 EmployeeName:…
John
  • 3,332
  • 5
  • 33
  • 55
50
votes
5 answers

How to avoid anemic domain models, or when to move methods from the entities into services

I have a common scenario that I am looking for some guidance from people more experienced with DDD and Domain Modeling in general. Say I start out building a blog engine, and the first requirement is that after an Article is posted, users can start…
Matt Hidinger
  • 1,743
  • 16
  • 16
50
votes
12 answers

Domain Validation in a CQRS architecture

Danger ... Danger Dr. Smith... Philosophical post ahead The purpose of this post is to determine if placing the validation logic outside of my domain entities (aggregate root actually) is actually granting me more flexibility or it's kamikaze…
Jupaol
  • 21,107
  • 8
  • 68
  • 100
50
votes
7 answers

What is domain driven design?

So I got this question from one of the developers in my team: What is domain driven design? I could of course point to the book from Evans but is that actually an answer? How would you explain DDD in a few sentences to junior software engineers in…
Hace
  • 1,421
  • 12
  • 17
49
votes
7 answers

What specific issue does the repository pattern solve?

(Note: My question has very similar concerns as the person who asked this question three months ago, but it was never answered.) I recently started working with MVC3 + Entity Framework and I keep reading that the best practice is to use the…
48
votes
4 answers

Should Domain Entities be exposed as Interfaces or as Plain Objects?

Should Domain Entities be exposed as Interfaces or as Plain Objects ? The User Interface : public interface IUser { string FirstName { get; set; } string LastName { get; set; } string Email { get; set; } Role Role { get; set;…
Yoann. B
  • 11,075
  • 19
  • 69
  • 111
47
votes
6 answers

Inheritance vs enum properties in the domain model

I had a discussion at work regarding "Inheritance in domain model is complicating developers life". I'm an OO programmer so I started to look for arguments that having inheritance in domain model will ease the developer life actually instead of…
47
votes
3 answers

CQRS Commands and Queries - Do they belong in the domain?

In CQRS, do they Commands and Queries belong in the Domain? Do the Events also belong in the Domain? If that is the case are the Command/Query Handlers just implementations in the infrastructure? Right now I have it layed out like…
Sam
  • 15,336
  • 25
  • 85
  • 148