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

Unit testing value objects in isolation from its dependencies

TL;DR How do you test a value object in isolation from its dependencies without stubbing or injecting them? In Misko Hevery's blog post To “new” or not to “new”… he advocates the following (quoted from the blog post): An Injectable class can ask…
Songo
  • 5,618
  • 8
  • 58
  • 96
4
votes
1 answer

Where in a domain model is it best to keep a reference to the current user?

How should the current user be passed to the repository classes? The current user's credentials are needed for the connection string used by the repositories. Should each repository be instantiated by having the username and password passed as…
Fikre
  • 555
  • 2
  • 7
  • 16
4
votes
3 answers

Which layer should be used for user authentication

I'm tying to use Domain Driven Design in one of my applications and have some question about user authentication. I have an aggregate root called User which has Value Objects like UserCredentials, Password, ActivationToken, etc. I also have few…
4
votes
2 answers

How to map a DDD Value Object in EF to a different table?

I have the following classes: public class Customer { public int CustomerId { get; private set; } public string Name { get; private set; } public Address MailingAddress { get; private set; } public Address BillingAddress { get;…
4
votes
2 answers

UPDATE statement conflict with FOREIGN KEY constraint in ASP.NET MVC4

I am actually working on an ASP.NET MVC4 application where we used the entity framework and the Model-View-View-Model approach and 7-layered architecture. We have one page where we need to insert or update "Product" information. The inserted or…
4
votes
2 answers

Domain service injecting into domain entities

I'm learning about Domain-Driven-Design and I'm a little confused about entities and injecting domain services into them. I have found this blog and conclusion is that injecting services into entities is a bad idea. I partially agree with that, but…
Mad Max
  • 186
  • 2
  • 11
4
votes
1 answer

Repositories for Aggregate Root Only!

I have Category and Product entities. The relationship between the two is one to many. Since, Category is aggregate root I think I should only make a single repository ICategoryRepository which should also handle products. Ideas?
john doe
  • 41
  • 2
4
votes
1 answer

EF6 failing to build model for Table Split/Shared Primary Key + Base class?

The problem I'm trying to share a large table (200+fields) around ~7 entities using table splitting as per my previous question. EF6 requires navigation properties not just from the primary model to the child models, but between all the child models…
4
votes
2 answers

EF6 Table splitting vs shared primary key for multiple splits

I am upgrading a legacy database system into .NET + Entity Framework 6 (code-first POCO) + PostgreSQL. For ease of programming, I wish to split a large table (200+ fields) into multiple entities,…
4
votes
2 answers

Should an aggregate root's behaviour be dependent on other aggregate root's attributes?

I'm reading a book about DDD and i see an example domain that involves cars, engines, wheels and tires . Above is the model as it is in the book . Customer is also aggregate root . Having that model , there might be a case where the engine…
Geo C.
  • 755
  • 6
  • 18
4
votes
5 answers

State Pattern with Memory

I was using State Pattern in a normal state machine. I wanted to be able to go from [A -> B], [B -> C], and [A -> C]. Now our domain has a new rule, now i need to go from [C -> A] also,but only if i have never been in B before. So we have states…
Miguel Marques
  • 2,386
  • 1
  • 20
  • 31
4
votes
2 answers

Entity Perspectives

Context: So, I am attempting to build a ridiculously complex domain model. Talking with the users, there are multiple ways the system will be used (For example: one way is from the perspective of the employee; another way is from the perspective…
Craig Wilson
  • 12,174
  • 3
  • 41
  • 45
4
votes
6 answers

Programming pattern / architectural question

I am currently working on a project where I have a BankAccount entity for some other entity. Each bank account as a reference to a bank entity, an account number and optionally an IBAN. Now since an IBAN can be validated, how can I ensure that when…
Chris
  • 7,229
  • 7
  • 41
  • 57
4
votes
1 answer

From CRUD to DDD

I've got an application that manages tickets and customers. A customer owns many tickets. If a customer is deleted, so are its tickets. This is one of the tests to see if an object should be an aggregate or not. I chose that they should both be…
Darthg8r
  • 12,377
  • 15
  • 63
  • 100
4
votes
2 answers

SOLID DDD ORM request (to use clean entities and repositories) for .NET

Is there a ORM that would leave my entities classes clean, withouth any attributes for properties and classes would not be ActiveRecord pattern so it should not have entity.Save/Delete etc. optional: able to execute stored procedures and parse…
Omu
  • 69,856
  • 92
  • 277
  • 407