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
1 vote
1 answer
215 views

Doubts how to design a card game in DDD

I was thinking how to design a simple cards game, like poker, in a DDD way, but I am not sure about some points. Basically what I want is this, but I will try to simplify the problems that I have. I ...
Álvaro García's user avatar
0 votes
1 answer
637 views

DDD - How to avoid validation rule duplication

From what I understand of DDD, my entities and value objects should be able to enforce its own invariants, meaning that its constructors will check for nulls, must contains numbers and letters, ...
Douglas Monteiro's user avatar
2 votes
1 answer
269 views

How to restrict the construction of a domain object to an external service?

I have this object RelativeFoo{int relativeCode, Origin relativeTo} And I want to map it to this other object AbsoluteFoo{int absoluteCode} In order to do this, I need to use a service whose ...
Douglas Monteiro's user avatar
1 vote
2 answers
429 views

DDD - How to handle one transaction across multiple bounded contexts when doing Save on multi-purpose UI page

I'm working on a HR application that has employee management and access control. We decided to go with these bounded contexts: Employee management: manage employees information, like name, contract, ...
Ramzi Hammouda's user avatar
2 votes
3 answers
367 views

What should we do in face of a failing sub in pub-sub?

I'm working on a microservices application that is implemented from the ground up with MediatR em CQRS. We have a list of domain events that will be published via MediatR [simple pub-sub library that ...
underthevoid's user avatar
0 votes
1 answer
184 views

Domain Modeling / Architecture

I'm experimenting with some projects at the moment and I am stuck trying to decide on the correct approach to this question. Given a simple architecture like this consisting of Domain - (Person and ...
Justim Odendaal's user avatar
-2 votes
2 answers
386 views

What's the difference between an Aggregate and a Model

We've recently taken up DDD approach to design. Some of our developers are using the Aggregate pattern (https://martinfowler.com/bliki/DDD_Aggregate.html) but to me this sounds very similar to the ...
Mr. Boy's user avatar
  • 231
0 votes
0 answers
111 views

Deal with users, permission and groups in DDD

I'm struggling when attempting to implement some logic about users and group permissions. Let's say i have a counter (which represents a group), each counter has an owner and one or more members. No ...
Samuel Verdejo de Toro's user avatar
1 vote
1 answer
375 views

How can we remove business logic from the frontend for complex, highly interactive UI's? Should business logic always live exclusively on the backend?

I have a UI for a tool with a fair amount of user interaction. Imagine a sports tournament predictor where you select which team will finish 1st in the group, 2nd in the group etc., with the winners ...
MSOACC's user avatar
  • 935
1 vote
1 answer
929 views

DDD: Can application services throw domain errors?

I'm new to DDD and I trying to create an API using DDD concepts for study purposes. Today, I faced a scenario where I've to create an Application Service to expose a functionality to be cosumed from ...
Gabriel Morishita's user avatar
1 vote
1 answer
1k views

Best practices repository and service layer

I have read many articles about repository pattern and service layer but I have still some doubts in certain arguments: Repository should return only aggregates and I should have repositories only ...
Alfons Deda's user avatar
0 votes
1 answer
79 views

Model events according to service internal domain model, or a shared model?

We have a system built on microservices with 50-100 different services. Previously most servcie-to-service communication was done with direct REST API calls, but we are shifting to a event based ...
viblo's user avatar
  • 101
2 votes
3 answers
418 views

To decouple or not to decouple? That could be the question

I read some very interesting discussions about decoupling microservices on this forum. One of the approaches is to ensure each service holds (parts of) the data of another context to allow it to ...
KDW's user avatar
  • 349
0 votes
1 answer
131 views

In DDD, must a Value Object turn into an Entity when some limited idenifiablity is required?

I have an Entity type, let's say Car for example. There is a Value Object type Tire for it. Each car has a set of tires with certain properties. Sometimes tires are replaced, which is communicated by ...
Erik Hofer's user avatar
0 votes
1 answer
473 views

Where to place "Backend for Frontend" logic in a DDD system

Assume I have a simple system with two (simplified) domains in the backend where the Root aggregates are the following, simplified ones: Product with product_id and description Warehouse with a ...
DaDaDom's user avatar
  • 101
1 vote
1 answer
210 views

How do I make conditional queries within DDD logic

I have created a small ERP application and the architecture I chose included the Repository pattern and the anemic Domain model and Business logic layer. I was reading Microsoft's guide about ...
Kostas Xagoraris's user avatar
1 vote
1 answer
176 views

Where should I fetch a product price to create an order in CQRS / DDD?

I want to save an order with order items with prices in my write database. But firstly I need to fetch products with their prices because I don't trust a user - he could pass a lower price, that's why ...
Aleksander Chelpski's user avatar
0 votes
1 answer
282 views

Where should I create my aggregate root? in api or frontend?

I am writing a simple application to apply what I have learned so far in DDD. I have the following mysql tables in my api server Sales Column id pk, int title varchar description varchar Images ...
emhsmath's user avatar
1 vote
2 answers
424 views

DDD for team composition

I have been asked by the BA/PM community in my company how DDD/domain modelling can be used as a tool when deciding how to form, split teams and how to decide their missions. I have my own thoughts on ...
edu's user avatar
  • 129
1 vote
4 answers
773 views

Why are async/await allowed inside the domain model of DDD?

I am trying to challenge my understanding of DDD by pushing it to the extreme. My question is not about a specific practical use case. Rather my question is an abstract one related to DDD in general. ...
geeko's user avatar
  • 236
0 votes
0 answers
47 views

Designing Aggregate Roots with Logic Spanning over Roots

This seems like a common scenario that someone must have solved by now! I have a setup where a Company may have a set of Default Roles assigned, and Users of that Company should inherit those roles. ...
BuddhiP's user avatar
  • 193
1 vote
1 answer
255 views

Internal/external commands in CQRS

I have several questions related to CQRS in eventually consistent systems with a need of resilient Command/Event processing. Is it OK to have external/public synchronous Commands (triggered by API, e....
Andrew Dunai's user avatar
0 votes
1 answer
555 views

Handling asynchronous domain events with multiple handlers & allowing them to fail independently

We're building a service using DDD, CQRS, & Hexagonal Architecture that allows the user to upload a CSV feed for which every row will be transformed and sent to a third party over HTTP. We have ...
Andrew Dunai's user avatar
0 votes
0 answers
136 views

Designing long running background jobs that are part of domain language

I am going to type out my problem in terms of my domain use case; When an Operator has an Ingest with a valid Dataset (Lowside, Drive and EntryPoints selected), they will opt to then Scan the Ingest. ...
Patrick Christie's user avatar
1 vote
2 answers
267 views

DDD rich domain model - dynamic dependencies - EAA

class Product... public static Product newWordProcessor(String name) { return new Product(name, new CompleteRecognitionStrategy()); } Martin Fowler presents this code in his book "Patterns of ...
Ten Jones's user avatar
1 vote
2 answers
121 views

Applying Domain Driven Design to applications with both reading and writing heavy logics

We are planning a complete rewrite of a very complex project (10+ years, ~15 different application modules) and we would like to adhere to DDD and CQRS as much as possible but we are struggling to fit ...
Andrew's user avatar
  • 11
0 votes
1 answer
408 views

Clean Architecture : Application State

Given the following design from clean architecture in which layer would you put overall application state? In each state a subset of use cases are allowed to be invoked. For example if application is ...
hamid's user avatar
  • 9
1 vote
2 answers
823 views

Help implementing call to external API and store summary in my database in hexagonal architecture with DDD

Good afternoon. My situation is this: I have to call an external API to create some data and store it there, but I want to have a summary of that data in my own database. I have my use case that ...
TheEmpire12's user avatar
1 vote
1 answer
1k views

How to update many properties in DDD?

I have this order: class Order { long Id; string Concept; string Comments; //another properties UpdateConcept(string paramConcept) {...} UpdateComments(string paramComments) {...} ...
Álvaro García's user avatar
0 votes
0 answers
73 views

Data Replication Without Messages

We have a legacy API service and database at my workplace. My team works on a mobile app that uses this API for some particular data. You can think of this as DDD - our service shares some entities ...
Michal Moravik's user avatar
-1 votes
1 answer
145 views

Why is it needed to use an event to notify the order was modified when I add a new order line?

I was reading some examples how to handle concurrency in DDD. One example is in this repository: https://github.com/kgrzybek/efcore-concurrency-handling/tree/master/src/OptimisticConcurrency/DDD.EF....
Álvaro García's user avatar
0 votes
1 answer
348 views

In DDD, concurrency belongs to application layer?

In DDD, the model has to implement only the bussiness logic, and it has not the responsability about another things, like persistance. So I was thinking that perhaps is in the application layer a good ...
Álvaro García's user avatar
0 votes
0 answers
75 views

Allowing an invalid state before an entity creation process is completed?

A lot of sites will save the progress of the creation of an entity or some process. For example, stackoverflow will allow you to draft a question before you post it. If StackOverflow used DDD, I would ...
Patrick Christie's user avatar
1 vote
2 answers
482 views

Software design patterns for versioning of domain entities/logic

I'm looking for specific software design patterns that can help me understand how versioning of the same entity where the domain logic has changed between the versions, can be solved. The following ...
martin's user avatar
  • 111
0 votes
0 answers
60 views

DDD entity validations that query 3rd party services

I have a separate server - called a Lowside - which hosts EntryPoints (business term for directories) on a DataDrive. In software terms, this means that a separate server contains some folders which ...
Patrick Christie's user avatar
0 votes
0 answers
214 views

in DDD, when I don't want navigation property from child to parent, is it still needed at least a property for the ID of the parent?

I have this: Class Order { long ID; ... } Class Item { long Id; IdProduct; decimal Amount; ... } Perhaps I misunderstood what means bidirectional relation in DDD, because I ...
Álvaro García's user avatar
0 votes
1 answer
97 views

Best practices to link, associate, or abstract similar but different entities together

What are the best practices that I can follow that can simplify or help abstract out entity modeling when there are many similar but different entities? I have a large game system with different types ...
user21918's user avatar
  • 111
0 votes
1 answer
101 views

When an entity has state, all the behavior depends on the state?

I was thinking in the common example orders, that can be in different statates. From create to pending to accept, accepted, sent... and so on. But the order has data too, for example the client, the ...
Álvaro García's user avatar
2 votes
2 answers
318 views

Relaxing layering rules for queries?

In a typical DDD layered architecture (application, domain & infrastructure layers) you'd generally declare interfaces in the domain/application layers and implement infrastructure-dependent (e.g. ...
plalx's user avatar
  • 389
0 votes
0 answers
264 views

How to post domain events with aggregate root Id before the root is persited?

This seems pretty newby question but I still can't find a answer I'm ok with. I'm doing a microservice and decided to have a Message as an aggregate root. This Message represents a kind of ...
lavrik's user avatar
  • 101
0 votes
2 answers
271 views

Is this a good alternative to state pattern?

I was trying to use the state pattern in a DDD aggregate, but I was thinking in the following alternative. In sumary, the state pattern controls what actions can be done in each state. This makes to ...
Álvaro García's user avatar
0 votes
1 answer
157 views

DDD: Where to put safety checks? Where to put the check if the user is allowed to do this?

I have a pretty simple domain model. Basically users, companies and groups. A user can add members to a group and remove them. But the user can only do that for his own company. Where do I put the ...
danielmoessner's user avatar
3 votes
2 answers
787 views

In the OO DDD , does the domain object access the repository directly?

I'm reading OO DDD slides from Robert Brautigam, who is quite active here so I hope he can personally answer as I quite agree with his personal understanding of DDD, and approach of having a more ...
Ced's user avatar
  • 285
1 vote
3 answers
349 views

Why is the product of the order item a reference to the ID of the product and not a value object?

I am seeing this example in the Microsoft documentation: Here we can see how OrderItem has a reference to the ID of the product, it is the first option that sure people uses to think, me too. But I ...
Álvaro García's user avatar
0 votes
0 answers
45 views

How to create an order if depends of anohter root entity?

If I have and order and a client. Both are aggregate root and they are different bounded contexts. Supose that I only can create and order if the client is not allowed (supose it has a bool property ...
Álvaro García's user avatar
0 votes
1 answer
54 views

One provider for all entities or different according to needs?

I am trying to design in DDD the management of orders to a privider. The order has to have the information of the provider to which i will order the items. Later I will add lines to the order. This ...
Álvaro García's user avatar
2 votes
1 answer
229 views

How to know the invoices of a project?

I have a project in which I have to manage projects, invoices and orders to providers. So I think that I can define three bounded context. First bounded context: Projects. Second bounded context: ...
Álvaro García's user avatar
1 vote
1 answer
308 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 ...
Rob's user avatar
  • 19
0 votes
2 answers
77 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 ...
Álvaro García's user avatar
2 votes
2 answers
614 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 ...
Ced's user avatar
  • 285

1
2
3 4 5
32