Skip to main content

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
3 answers
122 views

How to tackle synchronizing large amounts of data across services in an efficient way?

I am working at a retailer with a deep catalog of products and we are taking stock of our architecture. Currently, we use microservices, but all product information goes to a service that is getting ...
1 vote
3 answers
1k views

How to design an API wrapper with bulky operations on domain object? (Need guidance)

I need some guidance in designing an API wrapper for my backend APIs. I have tried to keep it as specific as possible. Context: We have a project which supports certain file operations like edit, ...
1 vote
2 answers
107 views

DDD Model to handle Localizations

I'm trying to refine my domain model for the internationalization feature, I wanted to get your input on the best approach to structuring Culture and Localization entities following Domain-Driven ...
5 votes
3 answers
2k views

Why "Event sourcing an entire system is a big mistake and considered an anti-pattern"?

Why event sourcing an entire system is a big mistake and considered an anti-pattern? And what situation it's consider an anti-pattern? Reference 1 Reference 2 Updated Question : Still don't ...
2 votes
2 answers
485 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; } ...
1 vote
0 answers
88 views

DDD -Can an aggregate consumes its own events?

I'm facing to an issue with my design in DDD with "Always valid Domain Model" principale and eventual consistency. I have an aggregate with several public methods to mutate its state. class ...
1 vote
1 answer
87 views

Is providing a method of a domain entity with a data/ service provider object a bad design?

I have an entity called User, and it has a method to change the user's email address. I'm using a strongly typed object for representing the email address. public class User: BaseEntity { // Some ...
7 votes
3 answers
5k views

Domain Driven Design - Updating and persisting aggregates

I'm trying to wrap my head around the best possible solution in the following situation: When updating part of an aggregate, could be any part of the aggregate so either the root or any other entity, ...
-1 votes
0 answers
69 views

ddd enforce business rule

Am struggling to identify whenever to create new domain service or capture business rules in my domain model. Assume we cannot assign Account to Invoice if Account IsInactive or Blocked class ...
1 vote
3 answers
107 views

DDD: big immutable item with some references to entity identifiers, should it be value object or entity?

Let's say I have a Mail, this mail have many properties given by the constructor (for example, 10-15 parameters). This mail can't be edited (immutable), the user has specifically requested to send ...
1 vote
2 answers
861 views

Entity Framework and Domain Driven Design Testability

I'm using a DDD approach for the Domain classes. Although, I have a problem on my design, that I'm handling it now but didn't have a good idea to over tackle it. My Architecture is the follow one: - ...
2 votes
3 answers
141 views

Modelling invariants over different aggregates

I am creating a simple Meal Tracking application and want to employ Domain-Driven Design principles. I've stumbled upon a Design problem that I'm not sure how to solve. Here are the components so far: ...
5 votes
1 answer
629 views

Applying Domain Driven Design - Model/Implementation

I'm quite new in the DDD-World and I'm just trying to figure out all the basics so please bear with me! I have the following Entities: - Datamodel - Object Types - Object Fields A datamodel can ...
0 votes
1 answer
124 views

How to model two bounded contexts with tight coupling between them

Context Hello, at my company we have been working with DDD for some time now. We have a monolith and some services. The bounded contexts in the monolith use HTTP calls to communicate between them or ...
-1 votes
1 answer
332 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 ...
1 vote
2 answers
147 views

Avoid updating multiple Aggregates in Library Application

I am currently analysing the project ddd-library which is really helping in learning designing a system based on DDD principles. However there is one thing I have a problem with. In case of placing a ...
5 votes
2 answers
672 views

Domain Events Grouping/Buffering

Suppose I have 3 domain events, Event1 Event2 and Event3. When command arrives at my Service Layer, I can rise 2 commands at the same time - e.g. Event1 and Event2. One Class has event listener for ...
2 votes
0 answers
405 views

Examples for "serverless" Java service for AWS Lambda

Doesn anybody have practical experience with implementing a (micro)service based on AWS Lambda? My team is currently working on an MVP. We started with a monolith and that has worked very well. It's ...
0 votes
1 answer
111 views

Where to put getOrSave responsibility?

I have many repeated parts of service logic which just fetches object if it exists or returns a newly saved one. I want to move it from service because it just clutters up the logic. But I do not ...
3 votes
2 answers
185 views

What value does the mediator pattern add beyond dependency injection?

Does the mediator pattern add any value beyond dependency injection? I am encountering the mediator pattern for the first time in context of this sample application, which is meant to demonstrate how ...
1 vote
2 answers
184 views

CQRS: Multiple entry points for a single command

I’m trying to follow the Clean Architecture and CQRS within an application that, let’s say, create a product. To achieve this, the application has 3 adapters, one for reading a file, another for ...
0 votes
2 answers
228 views

Domain Services vs Repositories when backed by a remote service

I'm building a DDD application which is effectively a wrapper around Cognito. As such, everything that this is doing is effectively just a call onto the Cognito SDK. Where I'm getting confused is how ...
6 votes
5 answers
6k views

DDD: accessing data from external service (REST, SOAP, etc.) as part of domain

I have a situation where my business logic depends on data coming from an external service. I initially though this would be a prime candidate for a domain service, but now I'm starting to wonder if ...
0 votes
0 answers
58 views

How handle foreign keys in bounded contexts inside a monolith?

in my company we have a Django monolithic application. To be clear, we are not looking into moving to micro-services. For the past few months, I have reading and implementing a DDD architecture inside ...
2 votes
2 answers
149 views

Unique Checks in Aggregates vs Database

I'm new to DDD and wondering what the best practice is to handle simple unique constraints. My application allows for creation of an Item that is named by the user - and this name must be unique ...
1 vote
1 answer
296 views

Is there a name for this API/type design principle? (I think of it as "state hygiene")

When designing types and their APIs, I try to adhere to these simple principles (which vaguely feel like one general principle to me) as much as feasible: There is a one-to-one correspondence between ...
0 votes
1 answer
122 views

DDD bounded contexts, shared tables

We're in the middle of writing a new app from scratch and planning to use DDD for this but we're all new to the process and trying to figure things out. The app at its core is a video conferencing ...
1 vote
0 answers
95 views

For a refactoring tool, are I/O operations part of the core domain?

I'm working on a refactoring tool that makes necessary adjustments to a Rust project when moving a source file from one location to another. Quick Explanation In Rust, source files are known as "...
0 votes
1 answer
96 views

Designing a balance's system in DDD using Event-Sourcing

I'm developing a driving-school application inside which students can reserve lessons by spending credits. Hence, students have a credit's balance. I want to represent this balance using event-...
1 vote
1 answer
158 views

Creating a repository for an entity in DDD

My application uses 3 types of User : Students, Teachers & Admins. The User base class serves as a mechanism for authentication, and I've decided for this project to use apikeys (note : it's a ...
1 vote
2 answers
80 views

Modeling multiple account types

I'm developing a monolithic application in which 3 types of accounts can live : Admin, Teacher and Student. They all need an authentication mechanism but expand to support various types of operations (...
0 votes
2 answers
124 views

Outside-in v. inside-out development in regard to DDD & BDD

BDD advocates for outside-in development because having a clear goal for your code helps you avoid getting bogged down in unnecessary details. It is usually mentioned in the same breath as DDD, but I'...
0 votes
0 answers
119 views

DDD - Managing Relationships between Domain Aggregates

To understand DDD better, I am trying to create the Domain Layer of an online class application. I have a concept of a Student, Tutor and Session. I thought of having one aggregate called Session and ...
0 votes
1 answer
611 views

Identifying Bounded Context in Task Management

I am currently trying out DDD with a sample application, "Task Management System". This is not related to any specific domain as such, it will be a generic application which can be used in ...
0 votes
1 answer
299 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
3 answers
297 views

How can I avoid duplicate annotations when validating both Entity and DTOs?

I am using the Spring Boot framework to create a RESTFUL API and I need a way to avoid the duplication of validation rules when using multiple DTOs as request/response objects for my endpoints. Using ...
0 votes
2 answers
94 views

cqrs/ddd - What is the point of having informational Data in the write model/aggregate?

I am wondering whether it makes sense to not store informational Data inside the write model database. By informational Data I mean data that is not directly used for any decision making in the write ...
0 votes
0 answers
118 views

DDD - How do scheduled tasks fit in CQRS/DDD

I am trying out CQRS, Event Sourcing and DDD in a project and I want to model a Reminder Service. The context is as follows: Person A creates a Task for Person B and sets a Deadline for Person B to ...
-3 votes
2 answers
109 views

Company and person or just contact table [closed]

Given the two models company and person I'm noticing duplicate fields i.e. zipcode, emailaddress for each. Yet, a short research reveals a reasonable popularity for separating those two entities into ...
2 votes
2 answers
160 views

Is it ever ok to have mapping logic inside a domain primitive?

We have some domain primitives for representing an Account an Amount with Currency etc. These are in a shared library, so all our microservices can use them. And then we started adding some ...
18 votes
3 answers
7k views

DDD - Is anemic domain model an antipattern? Shoud we be using rich domain models? [closed]

Anemic domain model was criticized a long time ago by Evans and Fowler, since apparently it goes against object oriented principles, etc. The DDD community is clearly aligned with this statements. ...
0 votes
2 answers
393 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 ...
1 vote
1 answer
475 views

DDD access to a composite Aggregate across Boundary Contexts

The behavior of my systems is as follows user places an order for a product 1a. order management creates a placeholder record for the order 1b. forwards the order to an external vendor. external ...
0 votes
1 answer
93 views

Authorization business logic on claims or on app database?

Context: I have an API (using DDD) with an entity lets call it "Content" that only can be update by certain users. For example Content with Id = 1, can only be modified by User Id = 1, ...
2 votes
2 answers
481 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; ... ...
6 votes
1 answer
5k views

Confused about commands, domain events and external events in event sourcing

I'm a little confused about commands role in event sourcing distinction between domain and external events If my understanding is right a command represents an action initiated by an actor in terms ...
3 votes
1 answer
118 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 ...
1 vote
4 answers
465 views

Is validation part of presentation layer or business logic? [duplicate]

We're working on a new project (backend, API), following the "clean code" and "clean architecture" principles (described in Robert Martin's books), dividing our application into ...
2 votes
2 answers
710 views

Where to define the interfaces of the infrastructure in a clean architecture and DDD?

I have been reading about clean architecture and following Domain-Driven Design. In all the examples I have found, the interfaces of the repository are defined in the domain. However, it is in the ...
1 vote
5 answers
632 views

When designing aggregates, can a child entity store another aggregate root ID?

I’m currently trying DDD with establishments’ opening hours: OpeningHours is an aggregate root; it ensures its openings don’t overlap an Establishment can be set many opening hours (like summer’s, ...

1
2 3 4 5
33