Stack Exchange Network

Stack Exchange network consists of 175 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
2answers
142 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
54 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 ...
0
votes
2answers
36 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
48 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
57 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 ...
0
votes
0answers
90 views

OOP - Composition Design Question

I'm currently working on redesigning a legacy survey system that was a simple CRUD application. The application consists of a: Survey which contains multiple Sections Section which contains multiple ...
1
vote
2answers
51 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
103 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
50 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
106 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
29 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
30 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
1answer
46 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
49 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
156 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
80 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
43 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
108 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
137 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
296 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
65 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
65 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
126 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
144 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
117 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
77 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
152 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 ...
42
votes
7answers
7k 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
69 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
95 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
141 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
75 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
108 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
156 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
121 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 ...
0
votes
0answers
29 views

How many exchanges when using scatter gather and CQRS?

I am trying to learn more about CQRS and enterprise integration in my spare time. I have created an application, which uses CQRS and the Scatter Gather Pattern. There are two web APIs for the CQRS ...
1
vote
1answer
89 views

DDD accessing reference values in Domain layer without repositories

So I have built a domain model and some logic into that. I have created two repositories for two aggregate roots. My question is how to access to the reference data from these layers?. For example, ...
1
vote
3answers
160 views

URL friendly id from DDD entity id

I am currently learning DDD and having a hard time wrapping my head about how to implements URL friendly ids for a web application. From my knowledge, in DDD it is common practice to use UUID as ...
0
votes
2answers
69 views

Bounded contexts and departments within company

We are working on several products as the IT department and we try to provide solutions for different departments within the same company. The core of our business is insurance and the main goal is to ...
2
votes
0answers
62 views

How should domain model entities expose information about the current state of their properties?

I'm new to DDD, so please bear with me. I am trying to design a domain model around an extremely large and complex existing system, where most of the current "domain" logic is either in the UI or in ...
2
votes
0answers
31 views

Can the read api receive events that the write api does not receive or raise?

Say I have a read API and a write API: MyApp.Write.api MyApp.Read.api Both API's handle integration events from other apis/microservices. Say I had certain integration events that only need to be ...
0
votes
1answer
28 views

Updating a Bound Context in One Database From A Master Database

Let's say I have two domains: Customers and Jobs. Customers is responsible for knowing what customers a user has access to. Jobs is responsible for knowing what jobs a user has access to (by ...
1
vote
2answers
86 views

Transforming one collection of objects into a separate unrelated collection?

Say I have a customer class class Customer(name, age) somewhere in my code, I have a list of customers List[Customers] at some point, I need to transform this list of customers into a Map with ...
1
vote
1answer
230 views

CQRS command that needs to work with multiple aggregate roots

I have have a business process that receives an order request which also includes full customer information. In the cases where the external customer ID from that order request is not found in our DB,...
1
vote
1answer
146 views

DDD many-to-many relationship on single entity

To provide a bit of context, the system I'm working on is a football database. A Squad has a collection of Rivals. Arsenal (Squad) has Tottenham and Chelsea as rivals, where Chelsea has Tottenham and ...
-3
votes
1answer
127 views

How to name the function of a thing differently than the thing itself?

A sensor identified by the serial number “ABC1234” fulfills a measurement function identified by the name “Pressure sensor 7” in a production facility. Within the production facility, nobody cares ...
2
votes
1answer
165 views

A problem with understanding aggregates and aggregate roots in Domain Driven Design (DDD)

I've stumbled upon a problem: "I can't split my domain models into aggregate roots". I'm a junior developer and novice at DDD. I really want to understand it, but sometimes it's really confusing. ...
1
vote
1answer
96 views

DDD Aggregate with Catalog Product

I'm new to DDD and I'm trying to figure out the aggregate root. I'm sure this question has been asked a million times. So I have : Products (thousands) Catalogs (hundreds) CatalogEntries that ...
0
votes
2answers
72 views

Data Replication Across Microservice Domains

One of the architectural challenges we are facing on a project is ensuring data consistency over our microservice domains. We have two rules that we are trying hard to enforce: 1. Services cannot ...
2
votes
4answers
407 views

How to adapt Clean Architecture to a rich desktop application

I'm just learning about clean architecture and I'm trying to design a proof of concept for an application I want to build soon. In the Clean Architecture the Presentation layer and the Domain Model ...