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
4
votes
2answers
205 views

CQRS sequential numbering of business documents

I am currently building a microservice-based system to learn CQRS/ES, Docker, AMQP and all the other goodies that goes with it. I have never asked a question online before as I am usually pretty good ...
0
votes
1answer
78 views

Creation of aggregate root that contains references to other aggregate roots

I would like to model the following entities: "Person", "Company" and the aggregate that ties the two together "Membership". I have identified that Person and Company are aggregate roots. Thus, "...
0
votes
0answers
43 views

Design Pattern: Communication between Model-Controllers and Model-ServiceAdapters

I am trying to architect a stand-alone WPF desktop app, but the question could be applied to any programming framework. This app has an UI where user interacts to send commands and receive/view ...
0
votes
3answers
171 views

Domain Models with complex properties construction

According to this article: Using Ids in Domain Models is not a good practice. We should reference the entire domain model instead. In this case, when we want to provide only Getters for our ...
1
vote
3answers
174 views

How to use data from another bounded context

The applications that I work with deal with Group level insurance. The insurance is mostly Life and Long Term Disability. We have a monolith library that all of our applications use at this time. We ...
1
vote
2answers
97 views

DDD: delete tree “Node” should check for children

I have a tree of Installations: Aggregate Installation has a property ParentInstallationId. I also have a RemoveInstallationCommand --> repo.GetInstallation(x).Remove() Now, I want to throw a ...
0
votes
2answers
100 views

Entity unique identifier in domain driven design

I'm just learning DDD and a question raised in my mind about unique identifiers in an entity. Consider this simple method that checks the uniqueness of an entity to prevent duplication: private ...
0
votes
1answer
72 views

How to handle Domain Event handlers ordering

Background: we have 2 bounded context: Inventory and Sale application context is Point-of-sale system Scenario: When a Checkout happen on Sale BC, we would like to decrease quantity in Inventory. ...
0
votes
1answer
97 views

Side-effect-free functions and returning domain information DDD

In Domain-Driven Design (Eric Evans) the discussion on side-effect-free functions talks about separating commands which "result in modifications to observable state" from queries which have no side-...
0
votes
1answer
61 views

Storing within the domain or use CQRS?

Assume we're building a fleet management system that is monitoring telemetry on a fleet of cars. Important telemetry include like location, speed and engine temperature. Metrics are mostly dynamic and ...
0
votes
1answer
81 views

Keep all user orders in a single aggregate instance

I'm thinking of not keeping user orders as separate Aggregate instances, but combine them into one UserOrders. Is such an approach going to have some flaws in terms of DDD? Along with orders, I would ...
-2
votes
1answer
99 views

A basic question on DDD aggregates order and payment

There's is a statement from https://martinfowler.com/bliki/DDD_Aggregate.html: An aggregate will have one of its component objects be the aggregate root. Any references from outside the aggregate ...
1
vote
2answers
115 views

Would I have one domain model (.NET Project) for all consumers or one domain model (.NET Project) per consumer?

Say I have a bounded context called: 'Loans' and the following APIs: HSBC NatWest TSB The three banks above are consumers and have an API. I am using the scatter gather pattern (https://www....
0
votes
1answer
81 views

Update Entity for Repository Pattern and UOW Pattern C#

In one mock solution, I have created 3 mock projects to implement layered architecture design mainly the - Presentation Layer (Web) - Domain Model Layer - Infrastructure Layer. I haven't yet to add ...
0
votes
2answers
103 views

F# DDD Bank Modelisation: Aggregate Design for Event Sourcing

I am designing a toy project dealing with the bank account management in F# with Event Sourcing. I would like to get a bit of review (not really a code review) about my Commands and Events to see if ...
3
votes
2answers
169 views

How should domain services be referenced?

I'm working on a test project, with the intention of using DDD. So far I have this basic project structure: My question is: How should the Core.Domain.Services be referenced? do I create an ...
2
votes
2answers
201 views

Can DDD entity rely upon infrastructure library?

Suppose I want this on my User entity: user.createNewSecurityToken(); That means: public void createNewSecurityToken() { var buffer = new byte[32]; new RNGCryptoServiceProvider().GetBytes(...
0
votes
1answer
71 views

Is a refresh token an entity or value object?

I have a User entity, which may have a RefreshToken (for authentication). Notes: A refresh token doesn't have "identity", but is related to a single user - it is only valid for that user. In the db ...
2
votes
3answers
125 views

Event sourcing: event's data (payload) vs metadata

There is often introduced a concept of using metadata in events. I just would like to understand the difference between data (which is referred to as payload) and metadata. I've read what I could ...
0
votes
1answer
60 views

Using the same entity for different use cases

Suppose I have a User entity with name and age attributes. A User can own Boxes. A Box has the name and color attributes. Business rules dictate that one User can own at most 5 boxes. So, in this case,...
0
votes
1answer
91 views

DDD persistence through non-orm tools in java

So our domain model drove our database and ORMs worked for DDD implementations. Now the tables have been altered a lot and as a consequence ORM impedence is too much in our domain model to use ...
1
vote
2answers
115 views

DDD different aggregates for the same model but different sagas / use cases?

I have an invoice aggregate that I create with a lot of data: $invoice = Invoice::create( InvoiceId::generate(), $lines, // Collection of lines InvoiceNumber::create('1'), $address, //...
2
votes
1answer
178 views

DDD - Creating and modifying my root aggregate based on request data

I have an invoice root aggregate that has many invoice line entities, a due date value object and two reminder entities. We're not using event sourcing yet. The post data I receive from the form the ...
0
votes
2answers
161 views

DDD How to populate AggregateRoot from Repository when properties and collections should be readonly

If the entity should be always in valid state (therefore the properties are readonly and can be set only by methods which contains validation), How can I build this entity inside Repository without ...
3
votes
2answers
459 views

Domain driven design project structure [closed]

I have recently started reading about domain driven design and most of the places it's explained or discussed more in conceptual terms. Being a design philosophy it helps to understand the concepts ...
1
vote
0answers
39 views

DDD - Translating Ubiquitous Language Vocabulary Across Bounded Contexts

One of the guidelines around building ubiquitous languages is that there should be one per bounded context. In a domain that has more than one bounded context, and therefore more than one ubiquitous ...
0
votes
0answers
40 views

Two JPA read/write Entities vs SpringJdbcTemplate for implementing CQRS without event sourcing?

So we are trying to implement DDD and CQRS (without event sourcing). I am need of clarity about the implementation details (Spring + JPA). DDD with multiple small aggregate roots require @Entity ...
0
votes
2answers
125 views

performance suggestions on Aggregate root containing thousands of child entities

I understand that DDD is a design concept and implementation through ORMs are tricky but help me understand how would you solve this problem? So here is my confusion on changing on aggregates only ...
0
votes
1answer
60 views

Can Aggregate shared between services?

I am working in an event-sourcing architecture and while creating the aggregates I came to an interesting challenge, disclaimer I'm new to this. I have a UserAggregate encapsulating the logic for ...
0
votes
1answer
165 views

Modify a property of an aggregate's entity

Suppose I have a house-lending service, like Airbnb. I have a House entity, which can have a name. There's also the Reservation entity, which has a start date, an end date, and a name (which isn't ...
1
vote
1answer
91 views

Are separate controllers used when adopting full scale CQRS?

I understand there are three flavours of CQRS: 1) Separate models only i.e. a domain model and a read model. 2) separate models and repositories. 3) Separate models; repositories and physical ...
0
votes
0answers
113 views

DDD: aggregate root and references to child entities

I'm struggling a bit to grasp all DDD concepts and apply them to a real project. Let's say I have the following domain concepts: Car: a vehicle moving inside an area Path: a journey made by a car, ...
1
vote
1answer
205 views

Domain Driven Design - updating part of aggregate

I'm playing around with DDD in a node.js project and struggling with updates to child entities from the aggregate root. For the sake of example, let's say I have two domain objects where Event is my ...
0
votes
1answer
167 views

DDD & composition

I have a project to build, which has the following requirements: topup a wallet by paying money in exchange for credit; this has also the constraint of needing an approval from the finance team, if ...
4
votes
2answers
434 views

Synchronization of data across microservices

We have 2 to 3 dozen microservices that serve our customers. These services are deployed in a Kubernetes cluster, and they're only accessible to the outside world through 3 or 4 API gateways. We ...
0
votes
2answers
103 views

Can a query handler (not repository) access a web service?

Say I have the following class, which maps to a database table: public class Person { public Guid Id {get; set; } public string Name {get; set; } public DateTime DateOfBirth {get; set; } public ...
0
votes
0answers
137 views

DDD: How to (mass) update aggregate roots?

I want to (mass) update aggregate roots with data from a leading external system. To do so a scheduler runs a task which fetches updates for my existing objects and data for new objects from the ...
1
vote
4answers
132 views

How do you domain model “arithmetic business types”?

What are best practices for modeling "arithmetic business types" like money or time? Is it recommended to make classes with explicit plus/multiply operations? Should there be a class for every ...
0
votes
1answer
165 views

How to maintain consistency on write when using Event Sourcing on a Banking System

We have a system that holds credit balances, and we thought event sourcing would be a good fit. Getting the current balance by reading from an eventually consistent projection works. However, I ...
2
votes
1answer
170 views

DDD / Onion architecture in JavaScript

One reason I like .NET is because the 'solutions' and 'projects' lends themselves to good architecture. Good architecture makes it easy to follow the happy path of Domain-Driven Design. I've fallen ...
0
votes
0answers
201 views

EventSourcing / CQRS Implementation with ASP.NET Core WebApi and Azure Cosmos DB

I was looking for an easy implementation of the Event Sourcing and CQRS Pattern in ASP.NET Core using Azure Cosmos DB as Event Store. As I couldn't find anything appropriate I decided to write a ...
3
votes
3answers
176 views

How to model User behaviour that can be shared between microservices in Event Driven architecture?

I have an Event Sourced system that has 3 micro services (simplified): User management - Registering a user, change password etc User account - manages debiting/crediting of the user account balance ...
43
votes
8answers
8k views

Is domain driven design an anti-SQL pattern?

I am diving in the domain driven design (DDD) and while I go more deeply in it there are some things that I don't get. As I understand it, a main point is to split the Domain Logic (Business Logic) ...
1
vote
2answers
99 views

CQRS and Transactional Event Sourcing, problem while recreating Read DB

I'll first explain the context of my problem. The backend of my current project is using DDD, CQRS and Event Sourcing as a stack (the read DB being a MongoDB, my write DB being an event store). At ...
2
votes
1answer
196 views

CQRS - Business Logic in Query Side

I am working on handling authorization for an application. I need some way for a command handler to ask the Authorization bounded context "Is this user allowed to perform this action?". User account ...
1
vote
2answers
440 views

How to structure files for API versioning?

My first time trying to implement API versioning here, and I need some guidelines on how to do it... I know there are many ways of doing API versioning. I'm already decided on doing it by uri (i.e, ...
1
vote
1answer
81 views

Knowledge-based authentication using Domain-driven Design in C#

I previously asked this question on Code Review but was told this was 'off-topic' so I am trying it here. I hope someone can help guide me. As part of an insurance claims system we have created, the ...
0
votes
1answer
160 views

DDD: Aggregate with nested childs

I have a CategoryClass (Aggregate root) -> SubCategoryClass -> and now a relational entity (n-n). Category (root) 1->N SubCategory 1->N SubCategorySlotType (n-n) SlotType (root) My SubCategory only ...
0
votes
1answer
235 views

Composite DTO or flattened DTO?

I'm having problem deciding which of these 2 structures to use from my DTOs: Option 1 is: @Data class Lines{ private final Line[] lines; } @Data class Line{ private final String[] specifiers; ...
4
votes
1answer
140 views

Efficient techniques to make a clean rename of a Ubiquitous Language term (DDD) throughout codebase

The problem A famous quote says: "There are only two hard things in Computer Science: cache invalidation and naming things" We all know how important ubiquitous language / good names in DDD are. I ...