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
22
votes
2 answers

Can Domain Services access Repositories?

Can Domain Services access Repositories? Or they should work on Aggregates/Entities passed to them by Application Services? Consider two code samples of the same business operation - money transfer. As first step, I alter account balances. Then I…
mgryszko
  • 556
  • 4
  • 12
22
votes
2 answers

methods in DDD entities vs services

Our team is fairly new to DDD, and are trying to implement some of the concepts in our current project. One question that has come up is whether to put methods into entity objects, or service objects. Some team members feel that entities should…
alchemical
  • 13,559
  • 23
  • 83
  • 110
22
votes
1 answer

How do I reduce duplication of domain/entity/DTO objects?

I am in the process of redesigning my current project to be more maintainable, and doing my best to follow good design practices. Currently I have a solution with a Silverlight component, ASP.Net host for said SL app that also contains a WCF RIA…
Bill Sambrone
  • 4,334
  • 4
  • 48
  • 70
22
votes
2 answers

Can a "rich domain model" violate the Single Responsibility Principle?

An interesting thread came up when I typed in this question just now. I don't think it answers my question though. I've been working a lot with .NET MVC3, where it's desirable to have an anemic model. View models and edit models are best off as dumb…
21
votes
3 answers

Uniqueness validation when using CQRS and Event sourcing

I'm trying to implement my own CQRS infrastructure with Event Sourcing to learn it better. As a sample project I'm implementing a blog engine, I know it might not be a perfect fit but I just want to work on something real. The problem I've come to…
Tomas Jansson
  • 22,767
  • 13
  • 83
  • 137
21
votes
5 answers

EF code first: How to delete a row from an entity's Collection while following DDD?

So here's the scenario: DDD states that you use a repository to get the aggregate root, then use that to add/remove to any collections it has. Adding is simple, you simple call .Add(Item item) on the Collection you wish to add to. A new row is added…
edgarian
  • 871
  • 7
  • 18
21
votes
4 answers

DDD: What kinds of behavior should I put on a domain entity?

My team tries very hard to stick to Domain Driven Design as an architectural strategy. But, most of the time, our domain entities are pretty anemic. We'd like to be putting more business/domain behavior on our domain entities. For example, Active…
Byron Sommardahl
  • 12,743
  • 15
  • 74
  • 131
21
votes
4 answers

Is Repository Singleton or Static or None of these?

I have a ASP.NET web site which uses domain driven design and uses repository for its database operations. I want to know that what is pros and cons of singleton repository and static repository and simple repository class which will new on every…
JGC
  • 12,737
  • 9
  • 35
  • 57
21
votes
3 answers

Having trouble putting real-world logic into the DDD domain layer

Despite having studied Domain Driven Design for a long time now there are still some basics that I simply figure out. It seems that every time I try to design a rich domain layer, I still need a lot of Domain Services or a thick Application Layer,…
lasseschou
  • 1,550
  • 15
  • 24
21
votes
3 answers

Is it okay to bypass the repository pattern for complex queries?

This is my understanding about DDD at the moment: The strict repository pattern should only implement get(), delete() and create(), and maybe variants of get() where one can search or to retrieve an entire collection It is common for each aggregate…
Extrakun
  • 19,057
  • 21
  • 82
  • 129
21
votes
3 answers

Confused about Spring-Data DDD repository pattern

I don't know so much about DDD repository pattern but the implementation in Spring is confusion me. public interface PersonRepository extends JpaRepository { … } As the interface extends JpaRepository (or MongoDBRepository...), if you…
21
votes
2 answers

Spring Boot: How to keep DDD entities clean from JPA/Hibernate Annotations?

I am writing an application that I wish to follow the DDD patterns, a typical entity class looks like this: @Entity @Table(name = "mydomain_persons") class Person { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; …
Lord Yggdrasill
  • 3,197
  • 4
  • 26
  • 42
21
votes
2 answers

DDD, domain entities/VO and JPA

I'm starting with DDD and you can image my brain is boiling. My question is related to my domain objects (entities, VO, ...) which represents my domain concepts/logic and how to persist/retrieve them. The blue book says the repository is a way to…
acanimal
  • 4,800
  • 3
  • 32
  • 41
21
votes
18 answers

Truly declarative language?

Does anyone know of a truly declarative language? The behavior I'm looking for is kind of what Excel does, where I can define variables and formulas, and have the formula's result change when the input changes (without having set the answer again…
21
votes
1 answer

How to use actors for database access and DDD?

I'm not quite sure how actors can be used to access the database. In the documentation and books for Akka this topic seems to be omitted. One solution can be a wrapped DAO in an stateless actor. For example for each table (or domain object type or…
Sebastian
  • 443
  • 3
  • 9