The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [domain-driven-design]

Domain-driven design (DDD) is an approach to develop software for complex needs by connecting the implementation to an evolving model.

Filter by
Sorted by
Tagged with
0
votes
2answers
27 views

Event Sourcing - Can a read model/projection be used in business rules within an aggregate?

I know that the general concept behind event sourcing is that the state of the application should be able to be replayed from the event stream. Sometimes, however, we need to get information for ...
0
votes
2answers
99 views

To what extent should DDD be applied - sample cases included

I am trying to understand DDD, but the scope to which we should seperate out domains seems a bit tricky to me. Consider a few cases: 1. Utility Consider I have a utility domain, with 2 helper ...
0
votes
1answer
109 views

Saga vs. Unit of work

What's the relationship between the two? Both are for atomic operations. Both results need to be either success, or failure with rollback to original state.
2
votes
1answer
90 views

Domain classes in DDD structure in React apps?

I'm building an Electron app using React. I'm coming from the C# and WPF world and I'm wondering, where should my domain classes go? I understand the concept of components, but what about a class with ...
2
votes
3answers
147 views

DataAccess Layer coupling with Domain Layer

We have an issue with how the implementation of the Data Access layer (EF6 Includes more specifically), influences the behavior of our Domain layer. A theoretical example to illustrate: Application ...
1
vote
2answers
82 views

value object validation in different use case

I am new to DDD approach and need some advice. I am going to use event site as an example. Say user can create event with start/end date. Event status can be running, expired, closed. Closed status ...
0
votes
0answers
41 views

Is one to one mapping necessary between Write Applications and Read Applications

We have a bunch of micro services (about 40) to serve our customers. To facilitate scaling and audit-ability of selected few micro services we have decided to redesign them using CQRS and event ...
3
votes
1answer
43 views

Event Sourcing Aggregate Roots - Interaction between aggregates and reconstitution

I have been doing a lot of reading/watching on event sourcing but some things still do not quite make sense. My application is a warehouse management system where we have: Deliveries of stock into ...
1
vote
2answers
65 views

Sorting a list of aggregates based on associated aggregate's properties

I am modelling a users management system, where users have a country of residence. I have modeled both User and Country as aggregate roots, and I am referencing the user's country by its ID internally....
0
votes
1answer
58 views

Designing a system which can use business rules to determine whether there is a difference between two versions of an entity

I'm trying to design a system which can determine whether there is a difference between a field or not given two objects. In my tool, we get multiple versions of the same title, with minor ...
2
votes
1answer
65 views

How to create large readonly entities in DDD?

I have an entity with around 20 properties. Following DDD, I want to make setters private and allow mutation only through methods, since there are some rules I have to check. But how should these ...
0
votes
1answer
24 views

How to determine aggrgates when entities are shared?

So I'm trying to figure out exactly what my aggregates/aggregate roots are in my structure, and can't seem to wrap my head around it. Database contains the following tables: SALESGROUP ID ...
0
votes
0answers
67 views

DDD Monolith eshop architecture based on multiple BoundedContexts Question

I´m creating my first eshop / CMS based on DDD / CQS concepts. I want to create application using BoundedContexts separtion as modular monolith at the first stage and maybe latter extract some BC as ...
0
votes
1answer
76 views

Reducing the code duplication between read and write application in CQRS

I am building an application and trying to embrace Domain Driven design principles, CQRS and event sourcing. We are having two applications one for reading and another for writing. The write ...
1
vote
2answers
69 views

Does references between entities of the same aggregate hurt the Aggregate Pattern from DDD?

Consider an application being implemented following Domain Driven Design. In the same aggregation, there are Car and Computer entities that should have a one to many relationship between them (Car ...
1
vote
1answer
49 views

ES/CQRS: How to access additional information in projections

I'm developing an event-sourced/CQRS application and do not understand the best strategy to use when building the read model projections when additional domain data is needed. A partial representation ...
2
votes
2answers
102 views

Dealing with property-level permissions in DDD and should UI or authorization influence the domain model?

Suppose I have a command like below: public sealed class UpdateExampleCommand { public int Field1 { get; set; } public string Field2 { get; set; } public bool Field3 { get; set; } ...
-2
votes
1answer
44 views

How to safe Consistency in DDD project in single aplication?

I want to design my project in DDD spirit. This is single aplication (not microservices) but with separate BC (as modules). Each BC have separate mongoDB collection. I have problem with communication ...
2
votes
0answers
42 views

Commiting transaction in the repository instead of the application service

After quite some time thinking about it, and testing both methods, I'm really struggling with choosing the right manner to commit my transactions. To shape the context, we are in the context of ...
1
vote
1answer
71 views

Bounded contexts and domain-wide public REST API

I'm prototyping out an application here where I'm using domain-driven design to identify the domain(s) of the application and I've ended up with something that - at least so far - feels like a fairly ...
0
votes
1answer
55 views

if two entities need to be created at the same time does this make them a DDD aggregate

Scenario I have a Customer and a CustomerSettings object. When I create a customer I also need to create their CustomerSettings object. These settings can dictate the customer experience immediately ...
0
votes
0answers
17 views

AWS SAM model for calling DDD functionality

I'm working my way through learning and implementing DDD. My domain is a ROI Calculator. I have an event store in place saving all the events that can happen with ROI Calculator. An instance of ROI ...
1
vote
1answer
67 views

Depend on DDD Entities or Interfaces?

My understanding is that the dependency inversion principle does not apply to entities, because entities basically are your application - it generally doesn't make sense to swap out a different ...
2
votes
1answer
37 views

How specific should administrative compensating events be in a CQRS/ES system?

Are there any best practices around how specific to make events that are generated administratively, say to clean up after one-off operational issues? For example: Say you have a credit card ...
3
votes
3answers
156 views

How to deal with UI data requirements in DDD

I'm using DDD and a CQRS/Event Sourcing architecture so my domain logic is separated in a microservice (e.g: command service) and the read side is in another microservice (e.g: query service). We ...
1
vote
1answer
84 views

OOP: Interface design when having objects embedded in parent classes

During the design of a small app I ended up with two possible design alternatives that both would work but, somehow, I feel one could be better than the other in terms of following OOP Principles, ...
1
vote
2answers
132 views

OO Design - Encapsulation question

Scenario Let's say that there is an entity in my domain called Shop. As a shop owner (user), I am able to create rewards that customer users will be able to exchange. It also could be possible to ...
0
votes
3answers
119 views

Aggregates and Tenant Ids

For multi-tenant systems, Vaughn Vernon suggests the tenant id should be on the domain entities. This doesn't seem right to me. The tenant id has no business meaning (with the exception of an ...
-3
votes
2answers
120 views

What is DDD's concepts mapping to microservice's concepts? [closed]

DDD concepts: Domain, Aggregate, Entity, Value object, Bounded context Should every aggregate be a single microservice and have a single DB ( since every microservice should have a single specific DB)...
2
votes
1answer
67 views

Does Domain-Driven Design apply to a component in a system?

I'm new to DDD. From my current understanding and from the examples I've seen in books or articles, DDD addresses the design of a software system to solve a complete domain problem. So it figures ...
2
votes
4answers
118 views

Design an entity with multiple representations (depending on the context / use-case)

Scenario Let's say there is a Shop entity in my app. And two types of users: a Customer and an Admin. When a customer buys anything at a shop, that customer's visit is registered in the system (there'...
3
votes
1answer
92 views

The relationship between a Command, Domain Event and Aggregate

I am new to the concept of DDD (with CQRS) so please, bare with me for this moment. I understand what are Aggregates, Entities, Domain Events and Commands but I really have a terrible time ...
1
vote
1answer
156 views

Is it acceptable to invoke business logic inside the repository layer?

I'm learning DDD and I'm wondering if it's ok to invoke domain model logic from inside the repository layer? I don't mean that the business logic exists as part of the repository, merely that the ...
1
vote
2answers
114 views

In DDD can an aggregate also just be an entity?

I'm working on an e-commerce solution and as part of this we have concepts of things like Stores, Currencies, Payment Methods, Shipping Methods to name a few. For each of these, we have an admin ...
1
vote
1answer
70 views

Domain Driven Design - Bi Directional association between aggregates

I've been struggling with modeling something out correctly, the DDD way. The use case is quite simple. You're a User, and you can be part of a Group. So we have a 1 - many between group and users ( ...
1
vote
1answer
84 views

DDD - Hardcoded Ids in Domain Model [closed]

I have a Business Layer, where I have put all the Entities of the Domain Model. Also there are Domain Services, where I put Domain Logic related to n Entities. One entity is : public class ...
0
votes
0answers
37 views

DDD with web api, how to correctly display error messages that caused by domain to the client?

I asked a question about duplicate validation in domain or application layer. Now, I decided to put all the business rules in the domain layer. I have a value object like this, it has a method for ...
-1
votes
1answer
84 views

Should Specification Patterns return IEnumerable, IQueryable, or Expression?

We are implementing Specification Patterns with Domain Driven Design. Company architect also wants us to utilize Generic repository (not my choice). Currently require specification Pattern for Filter ...
0
votes
0answers
82 views

API Class Input and Paging Specification Pattern in Net Core

I was reading following website, and created a PageModel and Specification pattern. Question is should I merge these two for good practice or keep separate? The PageModel will accept following ...
0
votes
1answer
66 views

Enforce invariants spanning multiple aggregates

Good day, Please help me solve the dilemma. I am trying to write an e-commerce engine relying on DDD. Problems associated with two aggregates, ProductType, and Product. Product is a classic product ...
2
votes
1answer
133 views

DDD with web api, validation in domain or application layer?

I saw a lot of discussion, but I don't know how to do it in a real world. I understand that validation duplication in the client and server is needed. But how to elegantly validate in server and ...
0
votes
1answer
112 views

Which Software Layer should hold Pagination Information?

Which layer should hold pagination information? (Page Size, Page Number), Eg say 100 products, 5 product per 20 pages. User can type in API url layer. api/Product?Page=1&Limit=2&ColumnSort=...
0
votes
1answer
132 views

Domain Driven Design: Should Specification Pattern exist in Repository or Application level for Paging?

In Domain Driven Design, should the specification pattern for paging/pagination exist on the Repository level or Application level, or another layer? Trying to see what Eric Evans author of DDD stated....
6
votes
3answers
249 views

Domain-Driven Design: Cross-Domain Search

I have two systems (for sake of example, and orders and an account domain). Their interfaces consist of an api per system (an orders api and an account api). I have a UI that is sitting on top of ...
0
votes
1answer
85 views

Application architecture using CQS and DDD Aggregates

I am working on a microservice architecture using CQS and with domain objects built using DDD aggregates. I am just beginning to learn about CQS, CQRS, Domain Driven Design, so excuse me if what I ...
0
votes
1answer
77 views

Domain Driven Design: Is OrderLine Detail a Nested Class of Order Header?

I had asked a question here, and someone had recommended that OrderLine be a Nested class within Order Header. Is that a standard practice in Domain Driven Design, or more one of many debated methods ...
0
votes
4answers
168 views

Which layer do DDD Repositories belong to?

In his DDD book Evans promotes the idea of layered architecture, and in particular that the business logic should be confined to domain layer and separated from UI/persistence/other concerns. He also ...
1
vote
3answers
108 views

Domain model entity layer depends on Persistance layer here?

I am trying to apply Domain-Driven Design here in this bank ATM mock app. I have 3 layers at the moment: Domain Model Entity layer (Pure POCO classes) Persistence layer (Entity Framework) Console UI ...
0
votes
1answer
135 views

Domain Driven Design // Navigation Properties and Aggregate

I'm currently making a REST API, using DDD. As ORM i use Entity Framework Core, this ORM has easy mappings for navigation properties, as you sure are familiar with. My question is about navigation ...
0
votes
2answers
155 views

Domain Driven Design too many structs

I'm trying to apply DDD to a Golang service and sometimes I find that I have too many structs. For example, I need to satisfy the requirements (for simplicity, I reduce the number of required fields):...