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
205 views

Sharing business validation cross Vertical Slices

I’m doing an task based application using Vertical Slice Architecture (VSA) and domain driven design (DDD). Tasks split into commands and queries and using Mediator pattern. Say I’m having an Order ...
  • 111
1 vote
0 answers
91 views

(How) should I handle a consistent but unwanted aggregate state?

It's clear that an entity should never be in an inconsistent state; if a change would violate an invariant, a domain object should reject the change. But what if it's left in a valid, but ...
0 votes
2 answers
392 views

Adding item to list process in domain driven design?

I will describe the problem in a typical example Todo Application. The user can have many TodoList. A TodoList could have many Todo. The use case is "Add Todo to the TodoList". In this case, ...
0 votes
1 answer
150 views

Reconstitute value objects from database

I am using Domain-Driven Design with Railway-oriented programming as an exception handling method. Every value object will not throw an Error, but return a Result type to indicate if it failed or ...
1 vote
3 answers
664 views

Value object depends on other value object

As I understand, most of the business logic is stored in the value objects as constraints, like the price cannot be less than 0. But I have a problem where the value object depends on another value ...
1 vote
1 answer
197 views

How to create an object requires multiple bounded contexts?

I will describe my problem with a very typical example, an e-commerce application. Says we have to manage Products, and we have 2 bounded contexts Sales, and Warehouse that store the product ...
0 votes
0 answers
35 views

Creating entity with external dependency inside the aggregateroot?

Okay, so, I'm working on an AuthService for my microservices system. I'm putting plenty of logic around single instance of User inside of it itself, just so I can avoid repeating code, breaking SRP or ...
  • 221
0 votes
0 answers
66 views

SOA: How to fan-in with unknown number of processes

In my event-driven architecture I have a situation where once an event is raised validation needs to occur and I'm wondering how to proceed to the next step in the process if I don't know how many ...
-2 votes
1 answer
72 views

Do I need to write Scenarios if I use Event Storming? [closed]

Event Storming is a great method to understand the business processes. Scenario (Use Case Specification) also describes the business process. They both do one thing. But when documenting, the Event ...
0 votes
1 answer
185 views

.NET: Microservices, Hexagonal Architecture with lightweight DDD - how to avoid leaky abstraction without a major performance loss?

So, I have a whole system built as microservices.On a service level, I'm utilizing Hexagonal Architecture with lightweight DDD (no events, aggregators etc.) I have a service that fetches Users via ...
  • 221
0 votes
2 answers
292 views

Explicit Modeling Aggregate Root to avoid State Pattern

In the book Patterns, Principles, and Practices of Domain-Driven Design, chapter 16, entities, Avoid the State Pattern; Use Explicit Modeling has brought the great idea of domain modeling to my life. ...
1 vote
1 answer
530 views

How to integrate Third-party Service in Domain Driven Design?

I will use the typical e-commerce system as an example of my problem here. The e-commerce system has bounded contexts like Sales, Shipping, Identity and Access. The Sales could be a core bounded ...
0 votes
1 answer
153 views

One read model project/microservice for all other bounded contexts - is it a good idea?

I have three bounded contexts: Users (generic subdomain), Groups (supporting subdomain) and Events (core domain). Basically users can create/join groups, create events within those groups, and sign up ...
1 vote
3 answers
1k views

Where should the user access bounded context stands in DDD and Clean Architecture?

I have seen some Bounded Context examples to learn DDD. In those examples, the User Access bounded context (register, login, authorization...) is considered a generic bounded context and could be a ...
0 votes
0 answers
128 views

Splitting nested entities keeping invariant within aggregates

I'm currently developing message imap-based module in crm app and i'm trying to connect dots using ddd principals. I've started with three main entities, all bound under Account Aggregate: Account - ...
4 votes
2 answers
783 views

How to manage data consistency between Bounded Contexts?

The typical example, the e-commerce system. Let's say the Order is in the Sales bounded context. Every Order contains many OrderLine, which stores the ProductId. The Product is in the Product Catalog ...
0 votes
2 answers
258 views

DDD and bounded contexts: can a context be mapped in multiple microservices?

Let's suppose that I have two bounded contexts: A and B. In books I'm reading authors will only write "Context A maps into Microservice A". Now I'm working on a project (university ...
  • 9
0 votes
1 answer
286 views

Different Aggregate Root States in Domain Driven Design

I have read the Domain Modeling Made Functional book. In the book, the author model the Order in 3 different states: Unvalidated Validated Priced The 3 states have different properties. But it's ...
2 votes
1 answer
478 views

Static validator in DDD value objects

I have a value object to hold a user id number as a string. This number has a unique format throughout my domain. So, it's being validated inside the object during instantiation and an exception is ...
-4 votes
3 answers
326 views

What are the abstract design patterns in Domain Driven Design?

I want to understand the Domain-Driven Design approach, how it works, and what it includes in its Definition. TLDNR What is the mental framework behind DDD? What are the core components of DDD? How ...
  • 242
-1 votes
1 answer
106 views

CQRS Domain Driven Design and single save button

This may be a dumb question, but I don't know how to solve this. I am moving from CRUD to Domain-Driven Design with CQRS. I have seen many DDD examples like this. You could find many more on Github. ...
0 votes
1 answer
784 views

DDD, Aggregates and paginate collections (specific case)

I want to apply DDD to a pet project and everything fits perfectly except for one part: aggregates with collections and the need of pagination. I've been researching about how to deal with an ...
  • 103
1 vote
1 answer
127 views

What to improve/change and how to move forward with my Event Storming session?

I'm doing alone session with Event Storming for my application that I plan to build with DDD approach later on. Event Storming session is for learning purposes. My application domain logic is rather ...
3 votes
1 answer
1k views

Data validation between microservices

Consider a scenario (in .Net Core world), where a microservice A collects data from external sources and sends this data asynchronously (RabbitMQ) to microservice B (the reporting system) where this ...
1 vote
1 answer
136 views

DDD - Many-to-many between aggregates

I have 2 aggregates: Occupation and WorkActivity. An Occupation can have multiple WorkActivity. A WorkActivity can also belong to many Occupation. The aggregate is a basic element of transfer of data ...
1 vote
2 answers
498 views

Defining Bounded Contexts using Business Capabilities or Domains?

I am new to Domain-Driven Design. When I was trying to define the bounded contexts of the software, I don't know where to start. After some searching on the Internet, I am totally confused. Some ...
0 votes
0 answers
59 views

Aggregate root validation and persistence [duplicate]

I am currently facing a few issues when implementing the logic in one of my Aggregates. Imagine an "Account" aggregate, which has email, password, verified and verificationDate fields (...
  • 101
0 votes
0 answers
39 views

Retrieving related information using the repository pattern [duplicate]

I'm currently working on refactoring a project to use the repository pattern, but I'm currently struggling with how related information should be retrieved. Let's say I have a Hotels and Rooms. I have ...
0 votes
4 answers
353 views

Should queries in CQRS be designed based on external demand?

I'm working in a microservice application which has some level of coupling between the microservices (some of them talk with each other via rest api - I know it is bad, but it is what it is; also I ...
0 votes
0 answers
72 views

DDD Value Objects: when is enough enough? [duplicate]

Where do you like to draw the line for modeling a single value as a Value Object v.s. a primitive? For example if I have an internal order number and a customer order number, would you model them both ...
0 votes
1 answer
2k views

Encapsulation of External API in Infrastructure Layer AS Persistence

My question is about DDD, the Infrastructure layer, it's relation to the Domain, and specifically how we can take advantage of the ability to "swap out" one persistence implementation for ...
2 votes
4 answers
700 views

How do I avoid tightly coupling one microservice to another microservice's feature that depends on specific views of the first's data?

I've seen this problem in a few different contexts now but I'm not sure what it's called or how to think about it. Suppose I have a service, AccountService, that serves accounts from a database, e.g. ...
0 votes
2 answers
473 views

Is putting logic in API gateway common/acceptable in DDD?

Let's use https://github.com/dotnet-architecture/eShopOnContainers as an example. There are CatalogService, BasketService and there is ApiGateway. In api gateway in BasketController there is ...
0 votes
1 answer
199 views

DDD+CQRS - Should I always check if the Databases are online?

I'm developing an intranet application and I'm trying to use some concepts from Domain Driven Design (DDD) and Command and Query Responsibility Segregation (CQRS) in .NET Core, with EFCore. But, to ...
0 votes
2 answers
646 views

Where to internationalize emails in a DDD application?

I am building an application with ASP.NET Core 5.0 following DDD and the CQRS pattern. I internationalize on the presentational layer but when I send emails I send them in the application layer via an ...
  • 21
0 votes
1 answer
104 views

Options for modeling nested/related workflows?

I am working on an application for awarding organizations by the CEO based on a somewhat complex criteria of multiple dimensions. The process consists of 3 nested workflows: Award workflow (opened → ...
  • 223
1 vote
2 answers
629 views

How to declare a Id value object?

For some more type safety I wanted to introduce a PageId type in my application. However, I am not totally sure what the best option to do so is. I want the IDs to be GUIDs, so I thought I just create ...
-1 votes
1 answer
79 views

Is there an Aggregate per-request or 1 fat aggregate per piece of domain?

My software has an Experiment as the central Entity which contains lots of details about how scientist does what he does. Basically 99% of the functionality happens within the Experiment and there ...
3 votes
3 answers
2k views

Importance of loading/saving complete aggregates at once in DDD

In the context of a web application where we handle only one command per request in a stateless fashion, do we always have to load/save aggregates as one atomic unit? Why is it recommended not to ...
  • 223
0 votes
0 answers
182 views

Saga / Processmanager?

I'm thinking about this scenario: I can receive customer inquiries by Email. Those inquiries can be sent from existing customers or unknown "customers" - I'll call latter "Leads". ...
  • 1
0 votes
1 answer
67 views

How should I model/design these aggregates?

I am new to DDD and I am trying model/design the aggregates of the following domain. The domain consists of several concepts: Assessment Models (AM) which contain Enabling Elements (EEs) and Focus ...
  • 223
0 votes
1 answer
219 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 ...
0 votes
2 answers
509 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 ...
  • 866
1 vote
1 answer
176 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 ...
1 vote
2 answers
852 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 the direct calls to the Infrastructure layer be made? At the Application ...
0 votes
2 answers
158 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 ...
  • 109
2 votes
2 answers
1k 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 ...
4 votes
2 answers
3k 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 ...
2 votes
2 answers
404 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
1 vote
2 answers
651 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 ...

1 2 3
4
5
31