Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

2
votes
0answers
34 views

How to deal with an event if the domain aggregate was not yet persisted?

When I call paid() on my aggregate it sets all the properties internally that need to be changed based on this action. But at this time the change has not been saved to the DB, so I can't reliably ...
-3
votes
1answer
115 views

DRY vs DDD principles - what is better in long run? [on hold]

In the process of implementing my domain, I cannot decide is it better to have single class with following method signature: void doSomething(Class1 param1, Class2... param2) Or to have two separate ...
1
vote
1answer
28 views

Paging params - domain repository interface

I usually define my repository interfaces at Domain Layer with DDD. Given that the UI needs to display some paged data I thought that adding params such as currentPage, pageSize, and define a model ...
0
votes
2answers
38 views

Methods taking parameter of Collection should filter the collection themselves or be passed a filtered collection?

Say I have this reasonable contrived situation: public class Toast { public bool Toasted { get; set; } public int MinutesToHeat { get; set;} } public class Toaster ...
0
votes
1answer
55 views

Too strong of coupling between aggregate roots?

In an effort to save this question, I have re-written it. The original question was regarding how to associate aggregate roots. I have re-factored the code slightly but believe this may couple the ...
0
votes
2answers
92 views

Should CQRS Command perform a Query?

I have Customer, Order, and Product Aggregate Roots... When the order is created, it takes in a Customer and a List<Sales.Items>. It looks something like: public class Order { public static ...
1
vote
1answer
62 views

How to handle a many to many relationship with an ORM mapped to a Domain Model when there are no technical constraints?

Domain Driven Design states that you should have a domain model, which reflects the ubiquitious language used by the domain experts. When using ORMs and many to many relationships I am use to doing ...
0
votes
1answer
24 views

CQRS across bounded contexts to generate reports with possible business logic

Where do you draw the line for how much logic can go in your read models? For example, we have 2 BCs: Inventory and Sales. We need to generate reports regarding inventory levels on specific dates: ...
0
votes
2answers
65 views

DDD - view-only aggregate roots, building DTO and a lazy loading problem

Suppose I am developing a RSS system (following DDD practises). Users have accounts. Accounts have feeds. Feeds have articles. Account, Feed and Article are my aggregate roots as well as ...
0
votes
2answers
50 views

DDD: repository for a nested entity?

I have a AR called User, which has among other entities one called City. The way I assign a City to a User is: $user->addCity($city); The problem comes when a id is given at some Controller ...
0
votes
1answer
58 views

DDD - Handling temporary inconsistency when handling domain events

I realize that DDD advocates eventual consistency, thus allowing for a certain period of time in which the system might be inconsistent. Embracing eventual consistency, we can therefore model our ...
1
vote
1answer
37 views

Cross-aggregate operations, use domain service or domain events?

I'm refactoring a settlements module in a large healthcare application. I'm trying to follow DDD. Let me give you a short and simplified description of the refactored code: A patient has an ...
2
votes
2answers
57 views

Define multiple DDD events or just one XXXChanged event when using CQRS?

Is it preferable to define a single 'container event' like below: trait UserStatus case object Active extends UserStatus case object Inactive extends UserStatus case class UserStatusChanged(...
0
votes
2answers
51 views

Void Or Other Result In DDD Operation

If this is basic question sorry , but anyway it is a question . i am doing domain driven design , i know about RootAggreegate , Anemic model , Rich Model , Domain Services , and ... but still when ...
1
vote
0answers
32 views

Domain Service vs Domain Events

What is the difference between using domain services and domain events? The thing I can see is that domain events allow you to further decouple your domain model and get away from using domain ...
0
votes
1answer
27 views

Referencing entity inside aggregate by local ID

How do you properly reference an entity inside an aggregate? For example, by the index of a list (doesn't seem smart if you re-order the list); a GUID (thought it was supposed to be local?); or some ...
1
vote
2answers
127 views

May Domain Events handlers lead to new events?

I want to understand the consequences of allowing handlers to be direct or indirect source of new domain events. In all examples I see in the literature Domain Events are usually published by ...
0
votes
1answer
137 views

DDD - Factory or Service?

I'm new to DDD, and I'm confused at the very start of my DDD project. To setup a context, I'm building the user management part of my app, so I'm building my Account entity, which contains an Id, a ...
2
votes
1answer
164 views

Ending up with too many services in DDD

I'm working on a project at the moment and I'm using this project to try and apply DDD. However, there are parts of my implementation that I just can't get my head around or don't feel right. I'll try ...
2
votes
0answers
32 views

How do I migrate part of a business process to DDD?

I am quite new to DDD, but I am currently working on a system which has a payroll element to it. I have a requirement to send payslips to an external system when they are created. Currently the ...
0
votes
1answer
113 views

Onion architecture applied to an .NET application

I am trying to figure out how to translate the onion architecture into an ASP.NET Core WebAPI solution, this is what I ended up with: Let's say I have an application that takes a file path / uri into ...
0
votes
2answers
124 views

Where should permissions be stored in a micro services architecture

We are currently in the process of building a service (a REST API) which is called on by our primary application. The primary application contains a users/permissions/roles set up which is used to ...
0
votes
5answers
220 views

Is using overly specific names for variable/class/component names a good or bad practice?

Let assume that we have a system in which the users can chat with each other and we are working on the backend. We can name the service which fetches the chats in one of the following ways: ...
1
vote
2answers
47 views

How to validate command before executing on aggregate when validation needs to query data?

In a DDD designed application with CQRS principle how do we handle the case when a command needs to be validated before it is executed on an aggregate and the validation needs to query the existing ...
0
votes
2answers
80 views

Lookup code tables in DDD

I'm curious on the best way to handle lookup-type codes that can be shared across bounded contexts. For instance, state codes, or business-specific type codes that might be used in more than one ...
0
votes
0answers
38 views

Aggregate root circular dependency when data needed for calculation

My original design has a domain service that did a lot of work which resulted in an Anemic Domain Model (concepts like BalanceCalculators, AccountServices, etc.). I refactored my design which resulted ...
2
votes
2answers
80 views

What exactly is the term “model” defined as in the context of Domain-Driven Development?

I am reading "Patterns, Principles, and Practices of Domain-Driven Design" by Scott Millett and Nick Tune and so far it has been a great read (first 2 chapters read) but one term they seem to use a ...
2
votes
1answer
48 views

How are events in the context of Event Sourcing different from Commands?

In the context of domain-driven design, events usually describe something that has already happened (domain events, integration events). Commands on the other hand are directives that may or may not ...
1
vote
3answers
75 views

DDD - what if aggregate depends on other aggregate

I am modelling UserAggregate using DDD concepts. I know that two separate users should be independent, but when creating a new user, I need to validate, that there is no other user with the same ...
1
vote
1answer
73 views

How does a Repository delete removed Value Objects from the DB without ORM?

Let's say an Entity is composed of multiple ValueObjects. For instance, a wanderer might leave a few footprints behind. Imagine I load Wanderer from a repository and delete all footsteps north of the ...
2
votes
1answer
56 views

Should I store an event stream or just state for a frequently changing entity?

I am building a CQRS-based application with Kafka Streams. For most entities in my application this entails event sourcing: capturing state mutations as events and transforming them into state which ...
2
votes
1answer
104 views

How to model domain events so that the denormalizers can fill highly denormalized read models

I have been working with a software strongly relying on the event sourcing and CQRS patterns for a few time and I'm trying to figure out how to properly model the domain events in relation to the ...
1
vote
1answer
100 views

How to update attributes on an entity from remote bounded context?

I see a lot of guidance in the DDD community around how to retrieve and use information from a remote bounded context (using an anticorruption layer, open host service, etc.), but hardly anything ...
9
votes
2answers
295 views

Is domain/persistence model isolation usually this awkward?

I'm diving into the concepts to Domain-Driven Design (DDD) and found some principles strange, especially regarding the isolation of domain and persistence model. Here is my basic understanding: A ...
0
votes
1answer
32 views

Can a bounded context be made up of other bounded contexts?

I am arguing with co worker that a bounded context can be made of other bounded contexts. My example is: I am having a tour context made out of flight bounded context hotel bounded context visa ...
0
votes
0answers
24 views

Aggregate inheritance in DDD [duplicate]

So one thing you do not hear much about is inheritance with DDD. Currently I have an Account aggregate that handles details regarding a financial account and its subaccounts. Then a Transaction ...
-1
votes
4answers
208 views

In a Domain Driven Development DDD, have a validation on a DTO that calls a external service is wrong, if yes, where should it be?

I have this question, is more about pattern and in theory what is wrong or not instead of if is possible or not (because it is). In a DDD design, I have a DTO that I am validating, to check not nulls,...
0
votes
2answers
218 views

DDD - Domain events vs application events

I'm considering two types of notifications: Domain events used internally within a bounded context Application events used to exchange notification messages between bounded contexts Each aggregate ...
2
votes
2answers
62 views

Denormalising a CRUD and ES bounded context for rich queries

As a small snapshot of my product, I have 2 bounded contexts, one which is a rich domain with defined events and invariants, operating on files implemented as CQRS/ES, and the other a CRUD store of ...
1
vote
0answers
41 views

Splitting a Bounded Context - administration and execution

TLDR: not quite sure whether I got my Bounded Context right. Situation I have a domain model in one Bounded Context: Entire model is in the same bounded context. Bounded context has two ...
1
vote
1answer
56 views

DDD Scheduling Flights

I'm fairly new to DDD and have been building a virtual airline app for flight simulators and I'm having trouble modelling the scheduling part of the app. A bit of the domain details: first you start ...
1
vote
2answers
61 views

get aggregate id based on its data in it

I have an aggregate root called SizeRangeAggregate which holds the range of size of clothing piece dimension and price for that range. I created an post rest API which create new SizeRangeAggregate. ...
-1
votes
1answer
68 views

Where should domain events be added: in entities or aggregate roots?

I'm designing the base classes and I don't know if I should add the field 'domainEvents' to the Entity class or only to the AggregateRoot class. I must add the code for add and remove events in ...
0
votes
1answer
131 views

DDD - How to do informative validation (specifically on entity creation)?

For my domain entities currently, all validation errors cause exceptions to be thrown. I don't like this as it doesn't allow me to compile all validation errors before exiting a method. I'd like to ...
0
votes
0answers
11 views

Is there any value in passivation (setReceiveTimeout) for persistent actors without read store?

I am not experienced in Akka, so my assumptions may be completely wrong. As far as I understand, Aggregate Root may manage its entities either just keeping their state internally and restoring it at ...
0
votes
1answer
140 views

Message Bus v Mediator pattern v In Memory Bus

I am struggling to understand when to use each of these: 1) Message Bus: Used to send integration events between Microservices. For example, Microservice A could publish an integration event, which ...
1
vote
2answers
94 views

Construct Entities via Dependency Injection Framework

I need help settling a disagreement, a co-worker and I have. We're working on a pretty huge Angular project and are in the process of looking at incorporating some Domain Driven Design principles into ...
1
vote
2answers
100 views

DDD : Can you event storm on your own?

I've recently been introduced into Domain Driven Design and we've done a lot of event storming in a simulated environment with a lot of people. Now I'm back in the real world and I've been given a ...
-1
votes
3answers
186 views

What is a CRUD system?

I am learning Event Sourcing in my spare time. I see lots of references to 'CRUD type systems' online. I understand a CRUD type system to be: 1) A database driven system (website or application) i....
2
votes
2answers
55 views

How to implement semantics of serializability in eventually consistent system?

In a distributed asynchronous system serializability cannot be achieved, but we still have to somehow provide the semantics. Consider quite natural requirement that user must have unique email or no ...