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
1 answer
164 views

Should Commands always be a facade to inner layers in CQRS?

In a DDD-CQRS scenario, should my commands in the Application/Service layer always be just a facade to different aggregation method and other inner layers like repository calls in the infrastructure ...
user avatar
0 votes
2 answers
136 views

Obtaining application generated ID from repository or from entity constructor?

In the Book "Implementing Domain-Driven Design" the author suggests to implement a repository method to provide the next application-generated (not database-generated) ID. Like so: class ...
user avatar
  • 796
1 vote
1 answer
109 views

How to represent association classes in a UML component diagram?

Please consider a class diagram and a component diagram as shown below. In the class diagram I use association classes to represent the relationship between two classes (BaseLink and ShoulderLink) as ...
user avatar
0 votes
2 answers
490 views

In CQRS/ES should database calls be done in command handlers or domain models?

In the context of a DDD application following CQRS and the event sourcing pattern, I have 2 questions. At which layer should be made the direct calls to the Infrastructure layer? At the Application ...
user avatar
0 votes
2 answers
122 views

May the left-side know the right-side when using CQRS with Hexagonal?

I'm trying to use the hexagonal architecture but I want the flexibility to make CUSTOM queries right to the database (or cache) to populate DTOs right from the left-side without passing through the ...
user avatar
  • 109
2 votes
2 answers
514 views

Validations and throwing exceptions in DDD?

I have a question regarding validations and exceptions in DDD. I have a ValueObject say, PasswordText which takes a string argument in it's constructor. Checks if the string matches the password ...
user avatar
3 votes
2 answers
1k views

Proper way to interact with child entities through aggregate root

In a DDD implementation, I am trying to design my domain model and the way to properly interact with child entities of an Aggregate through the Aggregate root. Imagine the following two classes in an ...
user avatar
2 votes
2 answers
198 views

Consistency and side-effects in DDD

Let's say I have an application where a user can do exercises and track them. I have the User entity: class User { private int stamina; private int experience; } And the Exercise entity: ...
user avatar
  • 31
0 votes
2 answers
358 views

Uniqueness in Aggregate Root - DDD

CLARIFICATION: There's a few articles around this point, I am trying to understand based on my use-case, what would you recommend as the AGGREGATE ROOT The problem Given a domain that allows creating ...
user avatar
1 vote
3 answers
3k views

What is the responsibility of Infrastructure layer in a clean architecture?

I am trying to follow Clean Architecture by Uncle Bob. I have 3 layers: Core (Hosts business logic, and is the central layer) Application (Host application usecases, and is directly above the core) ...
user avatar
0 votes
1 answer
70 views

DDD - How should a model be updated from an [HttpPut] rout in a RestAPI?

I'm learning DDD so apologies if the question is too naive. Assume an application that manages user publications developed following DDD and using a RestAPI for external interaction (for whatever ...
user avatar
0 votes
1 answer
65 views

Domain Driven Design one change per transaction

Why do they always say you can only change one aggregate per transaction? Decoupling? Is it a rule you can break or is it more of a strict thing? Does it also matter if we are in a monolith vs ...
user avatar
  • 183
0 votes
1 answer
350 views

Can "backend" be a subdomain?

Let's imagine an application where users can work collaboratively on projects. There's a project listing where a user can subscribe to a project, and a coworking screen where multiple users can work ...
user avatar
  • 396
3 votes
3 answers
1k views

Why DDD models should have private setters?

I'm learning about DDD and in many places it's stated that the domain model classes should have properties with private setters and explicit methods to change the model's state. I wonder the reasons ...
user avatar
1 vote
1 answer
179 views

DDD and analytics - is everything a value object?

(This relates to the problem domain I have previously elaborated on here - though the exact details are not that important for this question) I'm writing an analysis application for Blockchain (DeFi) ...
user avatar
  • 83
0 votes
2 answers
472 views

Entity lives in multiple aggregates in the same form

Context: Currently designing a product with a DDD mindset. Currently in a monolithic approach. However I'm refactoring a few things so I can change to a more loosely coupled monolith. We have an ...
user avatar
  • 183
0 votes
3 answers
334 views

ValueObjects exposing outside domain layer

As I learned from the DDD rules, you have to change the entity through the aggregate root. However let's say we have a value object "Address". Is it allowed to do in the AR: (I've seen this ...
user avatar
  • 183
1 vote
1 answer
83 views

DDD Aggregate reference differences

I've been reading about DDD a lot lately and something I can't find too much about is the following scenario: Let's say we have a Customer aggregate root and a Contract aggregate root. The reason they ...
user avatar
  • 183
0 votes
0 answers
198 views

Authorization and Cross-Cutting Concerns in DDD (CQRS) - Filtering Data

We are currently in the early phases of developing several applications that differ significantly in their functionality. As part of building these applications, we have also developed a few generic ...
user avatar
  • 49
0 votes
1 answer
109 views

List of ValueObjects a valid thing?

Let's say we have an entity Customer which can have multiple email addresses. We create a ValueObject "EmailAddress", upon creation it checks if the address is valid. Is this concept valid ...
user avatar
  • 183
1 vote
1 answer
46 views

Fix reference to entity under aggregate root

I'm in a situation that is the following: Company is an aggregate root and contains a list of contacts (name, phone, ..). On another aggregate root "Contract" you are able to add something ...
user avatar
  • 183
0 votes
0 answers
162 views

DDD shared concepts between entities

Currently there's an aggregate root "Party" which for now only can be an insurance policy holder. A party can have multiple addresses, communication addresses (telephone, mail, ..), contact ...
user avatar
  • 183
0 votes
2 answers
142 views

DDD Modeling - Entity with generic and specific data

Suppose I am buying coffee. There are several types of coffee (A1, A2, A3), but sometimes I want to make a reference to all types of coffee (like if I had a coffee "grouped"). Considering ...
user avatar
1 vote
2 answers
146 views

Should the Use Case be responsible for transforming its primitive parameters into typed data for the Entity to use?

I'm building a Use Case for creating blog posts, this Use Case has its own "DTO", which is basically a parameter object with only primitive data, as follows: Use Case's DTO (Parameter Object)...
user avatar
6 votes
1 answer
200 views

Should operations on properties of list objects be encapsulated in a domain class that wraps the list?

I have a list of product price objects, List<ProductPrice>. @Value public class ProductPrice { Long id; LocalDate startDate; LocalDate endDate; BigDecimal value; } From ...
user avatar
2 votes
4 answers
321 views

Are my Microservices too granular?

As the title states, I'm wondering if my current architecture is currently too granular. Additionally, I'm curious if I should be pursuing a microservice architecture in the first place. For context, ...
user avatar
2 votes
2 answers
337 views

Should an Use Case method receive a "pre-filled" entity or a DTO as a parameter?

I'm building a use-case for creating blog posts, at first I thought of using an entity as a use-case parameter, and this entity would be created by the layer that calls Use Case, in my case a ...
user avatar
2 votes
1 answer
425 views

DDD - Is it valid to have entities that are not part of any aggregate? (problem domain description included)

I've tried Googling this using several phrases and I simply can't find this asked anywhere so I hope this isn't too silly a question. I'm just dipping my toes into DDD and I have a toy project I'm ...
user avatar
  • 83
2 votes
2 answers
216 views

Exposing methods for polymorphic children from the aggregate root

Consider the following fictitious toy example: There is an aggregate root DayChecklist that holds a list of Tasks planned for the day: class DayChecklist { String id; DateTime today; ... ...
user avatar
  • 87
1 vote
3 answers
530 views

Some thoughts on the Repository pattern

Until this moment, I have seen a lot of variations and combinations of the Repository pattern, implementations that simply queried the required information, some used something like a mapper, some ...
user avatar
  • 23
0 votes
3 answers
522 views

DDD - storing and retrieving entities of an aggregate from the outside

In my doctor's appointment booking system, I identified the following entities: Doctor Patient Appointment I also identified an aggregate, which is Doctor (aggregate root) and Appointment. It's an ...
user avatar
2 votes
1 answer
227 views

Microservices: Is the Saga Pattern correctly applied here?

I'm trying to understand and learn how to build microservice messages the best and came up with this task for myself: Services given: Accounts Service Token Service Email Service When a user ...
user avatar
  • 461
0 votes
1 answer
230 views

DDD for middleware web application

I am developing a middleware application where the application workflow is: handles rest requests performs some business logic calls another rest service I would like to use DDD to model the ...
user avatar
  • 3
1 vote
1 answer
232 views

Dealing with business logic on DTOs using a DDD

I have a scenario in which an Entity defines an EntityRepresentation that is created from another end. The EntityRepresentation is a value object that implements some logic that should be performed on ...
user avatar
2 votes
3 answers
381 views

Aggregate roots always have to be "complete"?

Lets think about the most common Aggregate Root example: Order and OrderItems (or OrderLines). So I want a useCase called UpdateOrderItem. Given a OrderItemID and a complete OrderItemDTO in the ...
user avatar
4 votes
0 answers
448 views

Best practice to reuse use cases in a clean architecture

Imagine a "clean architecture" in which you have two use cases. One of them is CreateCustomerHandler, and the other SignUpCustomerByGoogleAuthHandler. So, the ...
user avatar
  • 149
-2 votes
1 answer
203 views

DDD Best way to preserve integrity of entity

I have an entity that contain the status of data (WaitingForData, ReadyForData, DataUsed). class Batch { int Status { get; } DateTime StartTime { get; } string Code { get; } void ...
user avatar
1 vote
1 answer
281 views

Can Domain Services publish Domain Events on multi-aggregate operations?

I'm in a scenario where, when a certain command is applied on an aggregate, I have to change the state of the aggregate itself if ALL related aggregates are in the same state, then notify the world ...
user avatar
1 vote
1 answer
75 views

Does injecting ILazyLoader inside entities in EF contradicts separation of concerns in design?

Microsoft suggests to inject ILazyLoader service inside entities in order to enable lazy loading manually in EF: https://docs.microsoft.com/en-us/ef/core/querying/related-data/lazy#lazy-loading-...
user avatar
  • 121
2 votes
1 answer
111 views

Separation of concerns

I'm approaching the DDD way and I was posing myself some questions. Assume that I'm writing an application that lets you define a nutritional week, where you can Define a nutritional week as a ...
user avatar
  • 149
1 vote
0 answers
114 views

Where does a Process Manager live with a Hexagonal/Ports and Adapters Architecture?

Context: I initially asked this question. I lacked some understanding and phrasing to ask the actual question I wanted to ask. The answer though helped me understand the friction points a bit better ...
user avatar
  • 2,341
2 votes
1 answer
122 views

Rust design when object needs to query outside data for some uses

I am modeling a ship that has contracts. Each contract can either be a fixed rate contract which pays a set fixed amount every day or a market index contract which pays an amount that varies based on ...
user avatar
  • 57
-3 votes
1 answer
255 views

How to handle dynamic data in DDD

In my app I have items which are dynamically created based on an UI editor. The item details is a JSON. The domain does not interact with the JSON details. The UI is responsable to create and render ...
user avatar
  • 203
3 votes
1 answer
294 views

Is an Event Subscriber an Application Service, an Infrastructure Adapter, or something else?

I have two separate, isolated Domain-Driven Design contexts, and have a feature that needs to be implemented to integrate them together in some way. Both of these are broken down in a Hexagonal/Ports ...
user avatar
  • 2,341
1 vote
1 answer
144 views

Does CQRS Handler can invoke another Handler because of relations to another Domain?

I have read DDD Vaughn Vernon book. There is a info about CQRS architecture. He mention that Handler can only do one Handler task, which I understand his and he cannot invoke other Handler. And even ...
user avatar
  • 111
0 votes
1 answer
227 views

How to model derived types (polymorphism?) in DDD

I have Orders which are raised against Contracts, which can be set up as either a fixed price contract or as per price per contracts. During Contract setup, allowed Products are assinged as ...
user avatar
0 votes
3 answers
258 views

Pattern for passing request context to business logic

I'm working on a project in which I have a clear separation between domain logic and the logic that exposes these features using an API (or whatever). For this I'm using the Onion Architecture. Now I ...
user avatar
  • 271
0 votes
0 answers
207 views

JSON Api Relationships and DDD Principles

In my current project we try to use DDD as development process and foundation of our architecture. For the REST-Interfaces it has been decided, that JSON:API is our way to go. Since DDD, REST and JSON:...
user avatar
  • 121
1 vote
2 answers
298 views

Where to put a deffiniton of an external data provider in a DDD/Onion Architecture application?

Consider that when working on an Application which is modelled using DDD and implemented using Onion Architecture, you come along a following business case: The Application, as one of its features, ...
user avatar
  • 523
0 votes
1 answer
247 views

How do I implement a domain entity behaviour that depends on some external infrastructure?

I am in the process of developing some software using CQRS, ES and DDD. A part of the system is writing services for controlling devices and collecting data from them. Consider a "Start" ...
user avatar
  • 11

1 2
3
4 5
29