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.
1,574
questions
1
vote
1
answer
311
views
Domain Driven design and representing process state
I'm trying to find a good way to implement state transitions for a job posting. This is just an experiment in trying to write better code.
You can find the code and a diagram in this repo.
The main ...
0
votes
2
answers
78
views
update state with the rest of properties or to have an action only to update the state?
I am thinking in a common orders and order lines example. The order has a state and depends on the state, I can do some actions or not.
I guess that a good option for that it is to use the state ...
2
votes
2
answers
630
views
DDD can part of the domain be found in infrastructure?
We have divided our app into vertical slices, by feature, each of which contains domain/data/application/ui layers which has increased cohesion. However there is still some coupling because feature B ...
2
votes
2
answers
319
views
Design Pattern: How to handle changing format of text file?
I have a text file which is evolving and thus, difficult to manage. Hence, I am going to rewrite the code from scratch. Since, only few parts of the txt file change with a newer version, from the ...
3
votes
1
answer
365
views
Is websocket connection a driving adapter or driven adapter in hexagonal architecture
I am creating an application using hexagonal architecture. The application uses WebSocket connections to communicate with some outside clients. Communication works in both ways. the client can send a ...
0
votes
1
answer
75
views
How to get the information from another root entity to validate some operation?
I am trying to put in practice a small DDD example but I have some dubts.
In my example, I have an Order and a Status.
The Order can be this:
Order
{
long Id;
long IdStatus;
long IdBuyer;
...
-2
votes
1
answer
198
views
Is it OK to use a Command Sourcing instead of Event Sourcing? Replay events in Commands-Repositories
I have a system that uses a graph database without any ORM, mapper or tool that tracks entity changes, like EntityFramework. I'm not using domain entities, instead I have an Event that calls changes ...
4
votes
2
answers
374
views
Microservice replica sync
In a microservice architecture, it's commonly admitted that each microservice should have its own replica from another "main" microservice acting as single source of truth. This keeps ...
3
votes
1
answer
87
views
High level abstraction of file scanning service in domain driven design, and the implementations
My domain requires that a Resource (ubiquitous language for a singular unit of data to be moved - commonly a file or folder) can only be moved if it has been Scanned to ensure it does not contain any ...
0
votes
2
answers
1k
views
DDD, Isn't `User` the aggregate root most of the time?
In ddd there is the concept of aggregate root.
The Aggregate Root is the parent Entity to all other Entities and Value Objects within the Aggregate.
It seems to me that User should be the root ...
-1
votes
1
answer
399
views
Identity Bounded Context for a small eCommerce System
I have to develop an eCommerce website following DDD.
I just completed Ardalis and Julie DDD pluralsight course and need to come up with bounded-context for this project.
Can you please assist if I ...
1
vote
1
answer
480
views
DDD - Modelling a system of groups and users
I'm looking for some advice on a system I'm designing, at its core it will allow users to create/join/manage groups of users.
I thought it would be a good idea to try and apply some DDD principles, ...
2
votes
1
answer
1k
views
How to scale transactional outbox pattern with document database?
I'm trying to understand CQRS, DDD by writing a small pet project which is somewhat similar to this great repo.
I've come across Transactional Outbox pattern and as imo it was correctly pointed out in ...
0
votes
1
answer
1k
views
Doubt about DDD, entity core and backing field
I was reading the documentation about how to use Entity Core in a DDD way. This is the documentation.
It is said that I can configure EF to can map an internal private field to a private field, the ...
1
vote
0
answers
45
views
Separating Typeorm Entities from Domain Entities [duplicate]
Is it a bad approach to add domain logic inside typeorm entities if following the domain model pattern to organize business logic.
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm&...
-3
votes
1
answer
319
views
Is DDD needed in full stack development?
I am a full stack developer who's been learning about Domain-Driven Design in the past couple of days, so I have some question since I have trouble finding place for this pattern in my applications.
I ...
1
vote
2
answers
456
views
Modules Design and Communication Between Them
I'm trying to design a monolithic application following DDD and clean code. Lets say I have Users, User Types, Products, Product Types and Purchases. I want to implement using different modules.
At ...
-2
votes
3
answers
200
views
Should I do dependency inversion on the same layer level
I'm working on an accounting service. I have to generate invoice for a user and upload it to the file storage. So my service would have to use a service from file storage team. File storage service ...
1
vote
0
answers
166
views
Business rule or repository implementation rule in Clean Architecture
I'm studying Clean Architecture with python and got into this "problem" of choosing where to implement a rule (that I considered a Business Rule, maybe I'm wrong)
I have 2 Entities
@...
3
votes
1
answer
288
views
Should repositories return self persisting entities?
In domain driven design
A repository is a collection like "interface" that hides data source access. It furnish add, remove and retrieval method just like a collection would. It does it ...
3
votes
3
answers
542
views
Are repositories async?
Repositories in ddd should give the illusion of an in memory
collection.
and
A Repository is essentially a facade for persistence that uses
Collection style semantics (Add, Update, Remove) to supply ...
3
votes
3
answers
1k
views
In DDD: is the domain who decides when to persist the data?
I am reading about DDD and in the examples it is common to see how the domain gets the data from database, do the business logic and then persist the data. For example to update a field:
class ...
0
votes
1
answer
266
views
DDD: Service role vs Repository
Context
I'm giving a try at my first backend API which aim to follow some Domain Driven Architecture concepts that I've learned from an implementation in Go in a Udemy course.
The problem is that I ...
1
vote
3
answers
637
views
Domain Driven Design - Aggregate Root and Nested Aggregate Invariants
I've come to a bit of an impasse with the best way to implement a DDD problem, and am hoping for some advice from those with more experience, please.
I have a RecipeCollection, which has a collection ...
2
votes
2
answers
305
views
High level 'implementation' of a use case in a layered/DDD architecture
I am trying to understand layered architectures and apply some DDD fundamentals to improve my architecture. I am finding that determining "what" an application service actually is, what its ...
0
votes
0
answers
143
views
DDD modeling with subtypes
I recently started learning about DDD and I'm in the process of designing a solution for an Auction module the issue I'm facing is that the different types of auctions have different characteristics ...
1
vote
1
answer
109
views
How to model your domain when having subtype?
I recently started learning about DDD and I'm in the process of designing my first solution.
I have a business requirement to design solution for Auction module and there are many types of auctions ...
0
votes
0
answers
96
views
Should Infrastructural Services Listen to Domain Events
I'm building an infrastructural service with my team. We are building a service that will help other teams in our org send out a notifications to end users when certain events occur. We are currently ...
-1
votes
1
answer
212
views
DDD Thought Process for Customers & Orders Relationship
I currently have a database centric web app for my company. For the office staff, the whole system is based around orders. There is an order list page. Warehouse manages his part by reading, preparing ...
0
votes
1
answer
200
views
Validation in a simple DDD example
I'm doing a simple project that represents a CI Pipeline in a low scale. So I'm trying to model "the best way possible" to practice DDD.
Basically I have the following information:
...
1
vote
1
answer
58
views
Can the same domain concept be a value object in one context and an agregate root in another?
I am learning Domain Driven Design currently and I'm trying to use it on an application that has a complex domain.
The application is fully configurable, meaning that most the domain objects can have ...
0
votes
2
answers
445
views
Dependency injection vs function parameter
I am working on a project that is structured in hexagonal architecture. It is a multi module gradle project where web layer is a separate module that depends on the domain module.
Sample code related ...
3
votes
1
answer
187
views
Reduce changes needed after adding a new field to domain object
I'm developing an application with DDD pattern with three layers:
API
Domain
DB
After adding a new field to the domain object, I realized that many places need to change. Imagine the following model....
0
votes
0
answers
106
views
Identify Domain Entities for a search tool interface - Clean Architecture
I am pretty new to Clean Architecture / Onion Achitecture, I actually not sure if the 2 terms are exchangeable.
So it pretty clear to me, considering is a few days I am reading and study about it.
It ...
1
vote
1
answer
160
views
How do I identify ways to break apart an Aggregate that has become my entire application?
I am developing an algorithmic trading framework using DDD/event-driven principles. I've decided the following components sit within my bounded context:
Data feed -> [Entry Point] -> "...
-1
votes
2
answers
115
views
How to make domain objects accessible to MVC controllers and views?
Summary of my question in a short form: How to propagate changes of domain objects upwards without introducing application logic into them?
Following 'facts' are based on prescriptions from respected ...
0
votes
2
answers
291
views
How to model transactions in a client-side functional DDD?
I'm new to DDD and I would like to clarify some concepts. I'm thinking about DDD in the client-side.
The first one is regarding transactions:
My understanding is that transactions are a responsibility ...
0
votes
2
answers
219
views
Are microservices unfit for our domain logic
I work in a software company with a single product, a 25 year old monolith application (1.2m lines of code) handling all HR related data (employments, salary, collective agreements etc.).
I've been ...
0
votes
0
answers
71
views
parent-child properties value inheritance at runtime/instance
I have 2 entities with a parent-child relation (like a base product and product variants), basically the two entities have the same properties and at runtime (when instantiating the object) if the the ...
1
vote
3
answers
572
views
Aggregates and control over children
Let's say you are performing a PUT request on an endpoint for a resource that holds a list of entities. For example, a football team and it's players. It would be fair to say that the list of players ...
0
votes
0
answers
539
views
DDD: Where to put business logic with conditionals etc., is it a domain service?
I would think the answer to my question is yes, but I have never really seen it in practice or any OSS project (and links to any OSS sample projects are highly welcome because the typical examples ...
4
votes
2
answers
1k
views
How to manage the entity which have collection of child entities in DDD?
A play arena contain a list of Machines and Amenities
playArena :
guid : GUID
name : string
location: Location
owner: string
amenities: Amenities
playing_machines: PlayingMachines
...
0
votes
0
answers
411
views
DDD - Communication between bounded contexts
I have two bounded contexts, Store and Inventory. The Store context has the Product aggregate, the Inventory context also have an aggregate called Product. Product is a different concept inside each ...
2
votes
3
answers
352
views
How to implement HATEOAS with CQRS?
Let's say I have a CQRS system where my write model contains the business rules. My read model is simply a DTO; it is a collection of properties and "dumb".
Now if you were to create a REST ...
0
votes
2
answers
572
views
DDD: Where to place a service that transform data our of the domain
I am new on DDD and hexagonal architecture and I am stuck in deciding where to place a very simple piece of code.
To code is a simple JWT decode. For SRP reasons, I want to isolate this action into an ...
0
votes
1
answer
640
views
Clean Architecture: How to decouple the Repository from a CommandHandler?
We are just starting with event driven (and clean) architecture.
So far we have two main entrypoints, a consumer (reader from a Redis Stream / Kafka Topic), and an API.
As this is almost a modular ...
1
vote
1
answer
107
views
Side effect as a common object seems like a bad pattern
Given an auction system, there are several ways to apply a discount to the transaction's final amount, e.g.
Special discount for a given seller
discount for a given buyer
Discount for a specific ...
0
votes
0
answers
80
views
Doubts designing an old system using DDD
We have the following system:
References that identify a product and have a family which identifies a group in which the reference belongs.
Families that are a way to group references, for example, if ...
0
votes
1
answer
40
views
Referencing another ARs value object
My domain is a pipeline for processing data and sending it off to another place afterwards. It's defined by these rules:
Data is divided into Signals, which have some identifiers (name, category, ...
-2
votes
1
answer
220
views
Domain Driven Design: ElasticSearch and Postgres together
Let me start by saying my knowledge of microservices isn't as strong as it could be. My understanding of DDD is that we'd draw a bounded context over an entity and that would be our service.
How does ...