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
0answers
95 views

Aggregate root circular dependency when data needed for calculation

My original design has a domain service that did a lot of work which resulted in an Anemic Domain Model (concepts like BalanceCalculators, AccountServices, etc.). I refactored my design which resulted ...
2
votes
2answers
91 views

What exactly is the term “model” defined as in the context of Domain-Driven Development?

I am reading "Patterns, Principles, and Practices of Domain-Driven Design" by Scott Millett and Nick Tune and so far it has been a great read (first 2 chapters read) but one term they seem to use a ...
2
votes
1answer
172 views

How are events in the context of Event Sourcing different from Commands?

In the context of domain-driven design, events usually describe something that has already happened (domain events, integration events). Commands on the other hand are directives that may or may not ...
1
vote
3answers
180 views

DDD - what if aggregate depends on other aggregate

I am modelling UserAggregate using DDD concepts. I know that two separate users should be independent, but when creating a new user, I need to validate, that there is no other user with the same ...
1
vote
1answer
242 views

How does a Repository delete removed Value Objects from the DB without ORM?

Let's say an Entity is composed of multiple ValueObjects. For instance, a wanderer might leave a few footprints behind. Imagine I load Wanderer from a repository and delete all footsteps north of the ...
2
votes
1answer
86 views

Should I store an event stream or just state for a frequently changing entity?

I am building a CQRS-based application with Kafka Streams. For most entities in my application this entails event sourcing: capturing state mutations as events and transforming them into state which ...
2
votes
1answer
516 views

How to model domain events so that the denormalizers can fill highly denormalized read models

I have been working with a software strongly relying on the event sourcing and CQRS patterns for a few time and I'm trying to figure out how to properly model the domain events in relation to the ...
1
vote
1answer
146 views

How to update attributes on an entity from remote bounded context?

I see a lot of guidance in the DDD community around how to retrieve and use information from a remote bounded context (using an anticorruption layer, open host service, etc.), but hardly anything ...
9
votes
2answers
719 views

Is domain/persistence model isolation usually this awkward?

I'm diving into the concepts to Domain-Driven Design (DDD) and found some principles strange, especially regarding the isolation of domain and persistence model. Here is my basic understanding: A ...
0
votes
2answers
301 views

Can a bounded context be made up of other bounded contexts?

I am arguing with co worker that a bounded context can be made of other bounded contexts. My example is: I am having a tour context made out of flight bounded context hotel bounded context visa ...
0
votes
0answers
71 views

Aggregate inheritance in DDD [duplicate]

So one thing you do not hear much about is inheritance with DDD. Currently I have an Account aggregate that handles details regarding a financial account and its subaccounts. Then a Transaction ...
-1
votes
4answers
666 views

In a Domain Driven Development DDD, have a validation on a DTO that calls a external service is wrong, if yes, where should it be?

I have this question, is more about pattern and in theory what is wrong or not instead of if is possible or not (because it is). In a DDD design, I have a DTO that I am validating, to check not nulls,...
2
votes
2answers
2k views

DDD - Domain events vs application events

I'm considering two types of notifications: Domain events used internally within a bounded context Application events used to exchange notification messages between bounded contexts Each aggregate ...
2
votes
2answers
135 views

Denormalising a CRUD and ES bounded context for rich queries

As a small snapshot of my product, I have 2 bounded contexts, one which is a rich domain with defined events and invariants, operating on files implemented as CQRS/ES, and the other a CRUD store of ...
1
vote
0answers
164 views

Splitting a Bounded Context - administration and execution

TLDR: not quite sure whether I got my Bounded Context right. Situation I have a domain model in one Bounded Context: Entire model is in the same bounded context. Bounded context has two ...
1
vote
1answer
216 views

DDD Scheduling Flights

I'm fairly new to DDD and have been building a virtual airline app for flight simulators and I'm having trouble modelling the scheduling part of the app. A bit of the domain details: first you start ...
2
votes
3answers
423 views

get aggregate id based on its data in it

I have an aggregate root called SizeRangeAggregate which holds the range of size of clothing piece dimension and price for that range. I created an post rest API which create new SizeRangeAggregate. ...
-1
votes
1answer
337 views

Where should domain events be added: in entities or aggregate roots?

I'm designing the base classes and I don't know if I should add the field 'domainEvents' to the Entity class or only to the AggregateRoot class. I must add the code for add and remove events in ...
1
vote
2answers
914 views

DDD - How to do informative validation (specifically on entity creation)?

For my domain entities currently, all validation errors cause exceptions to be thrown. I don't like this as it doesn't allow me to compile all validation errors before exiting a method. I'd like to ...
0
votes
1answer
988 views

Message Bus v Mediator pattern v In Memory Bus

I am struggling to understand when to use each of these: 1) Message Bus: Used to send integration events between Microservices. For example, Microservice A could publish an integration event, which ...
2
votes
2answers
391 views

Construct Entities via Dependency Injection Framework

I need help settling a disagreement, a co-worker and I have. We're working on a pretty huge Angular project and are in the process of looking at incorporating some Domain Driven Design principles into ...
1
vote
2answers
178 views

DDD : Can you event storm on your own?

I've recently been introduced into Domain Driven Design and we've done a lot of event storming in a simulated environment with a lot of people. Now I'm back in the real world and I've been given a ...
-1
votes
3answers
430 views

What is a CRUD system?

I am learning Event Sourcing in my spare time. I see lots of references to 'CRUD type systems' online. I understand a CRUD type system to be: 1) A database driven system (website or application) i....
2
votes
2answers
58 views

How to implement semantics of serializability in eventually consistent system?

In a distributed asynchronous system serializability cannot be achieved, but we still have to somehow provide the semantics. Consider quite natural requirement that user must have unique email or no ...
3
votes
2answers
3k views

Separating Domain Object and Data Models

I looked through a lot of articles, blogs, and SO topics about separating domain object and data models. Almost every answer said: You should have separate classes for the domain and data persistence, ...
1
vote
0answers
63 views

DDD: How to resolve aggregate members needing dependecies?

I have the following aggregate: Checkout (root) Requirement: CouponRequirement, AnotherRequirement, YetAnotherRequirement Coupon A Checkout has many requirements that need to be fulfilled in order ...
2
votes
1answer
788 views

Understanding DDD when using an ORM such as Hibernate

I've reading about Domain Driven Design and Anemic models. I generally work with an ORM such as Hibernate, and I'm struggling to understand in DDD what a business model can and can't do. For example,...
3
votes
2answers
266 views

How do entities, DTO, DOA work together and what’s their role within a system?

Most of my work is written in Java using Spring Boot. In a recent project my entities contained no business logic, Spring Data was used to handle repositories and I have service classes that ...
3
votes
1answer
270 views

On layered architecture with ddd

I've been working on an architecture, trying to learn more about DDD, layered architecture, etc. Here's what I have: Domain Here I have my entities, the classes that directly map to a database table....
4
votes
1answer
230 views

Is it worth considering State pattern in this case

I've got the following state diagram that can be seen in Webgraphviz: digraph reload_states { rankdir=LR; size="8,5" node [shape = doublecircle]; Requested; node [shape = circle]; ...
3
votes
1answer
150 views

Repository that performs API calls internally - DDD

Please note: although my question relates to DDD, I am also interested in this from an architectural and OO design perspective. This question may also be a simple case of CQRS and/or interface ...
0
votes
1answer
252 views

In an n-layer architecture with MVP in the presentation layer, how the presentation layer interacts with the business layer?

I am pretty new to software architecture, and I am trying to understand the basic concepts of n-layer architecture and MVP (specifically Passive View). My current understanding of n-layer ...
4
votes
1answer
193 views

DDD with web application - How to avoid rule duplication?

Imagine we have a simple rule: A member must be at least 18 years old to join. Imagine we have a C# class for Member and it is our domain model. The rule is enforced in this class. Now we create ...
4
votes
1answer
2k views

Access multiple entities in repository - clean architecture

I have a API call that returns a list of Payments, each Payment contains a User. I need to call it, save the results in the database, fetch all the payments and users and return them all to the ...
2
votes
2answers
194 views

Strategy/domain object responsibilities

Assume we are in the world of car rental application :) Let's say that I have 3 types of cars with 2 categories of price: Car type Price category ------------------------------ Sport ...
0
votes
1answer
291 views

Implementing CQRS inside a Microservice

I am considering a CQRS refactoring process. It is more of a learning exercise in my spare time. The use case is similar to a price comparison website where a user enters their details for a ...
1
vote
2answers
641 views

Putting it all together - DDD, CQRS, Web API

I need some expert guidance. I'm trying to learn the concepts as well as implement them, and it's possible I might be over-engineering some. But that's OK, because I am wanting to learn and gain ...
4
votes
4answers
1k views

Mapping API models(DTOs) to rich domain models

How to implement HTTP's PUT that works with child collections when using DDD's rich domain models? Let's say we've got an aggregate root with a nicely encapsulated collection of items: (I omitted ...
2
votes
5answers
168 views

Is a point drawn on a canvas considered an entity in domain driven design?

I'm reading on DDD and came across this excerpt: Let’s consider a drawing application. The user is presented a canvas and he can draw any points and lines of any thickness, style and color. It is ...
1
vote
1answer
367 views

DDD Relations between child entities / value objects

I'm new to DDD and trying to wrap my head around it by writing a prototype for an application (Core-Logic-Layer). My domain model looks like this atm. (I leaved out parts, that weren't necessary for ...
0
votes
1answer
195 views

What is the correct granularity for events in the context of designing a rule-based decision system?

Introduction We need to design a system that, given a set of events that are happening in the source application, reacts to them and if some conditions have been met, actions can be triggered. Users ...
2
votes
0answers
117 views

UI syncing in case of bulk operation api

In a CQRS system, the convention that we follow is we render the detail view of an aggregate(i.e getById) using the write model and views containing multiple aggregates(like a dashboard) using read ...
2
votes
0answers
112 views

How to design a sync api exposed to third party which involves a business transaction across aggregates?

Business Domain In the Sales domain, I have 3 entities - Lead, Contact and Opportunity. A lead is injected into the system from many sources and nurtured. If it is a prospect then it is converted ...
0
votes
1answer
61 views

Is changing the domain according to the user privilege on specific fields considered as anti-pattern?

Is changing the domain according to the user privilege on specific fields considered as anti-pattern? My case: I have Schedule Entity (aggregate root) like this: public class Schedule : Entity<...
3
votes
4answers
1k views

Command handling fail feedback with CQRS

We are developing some context using CQRS approach. We have ended up with command handlers emitting events. It seems to be not a good idea to us. However we can't find any alternative approach. We ...
2
votes
1answer
720 views

Modeling request/response in domain driven design

Say I have a class of User and that user has an Id & Name, in request response modeling, I would make a request with Name on it and a response with Id and Name, thereby my domain model would be ...
1
vote
3answers
268 views

Event Sourcing - Reconstituting Aggregate from Wrong Event Stream

I am working on a project to help learn DDD and am trying to do CQRS and Event Sourcing. Code is in C#. For this example, lets say I have 2 aggregates, Customer and Product. My aggregate repository ...
2
votes
3answers
129 views

How are new bounded contexts deployed, and bugs fixed, in message-driven “autonomous” microservice architectures?

I'm coming from the monolith background, using a single large relational database. From my research, many proponents of the microservice architecture favor the event-driven rather than REST driven ...
4
votes
2answers
442 views

Deconstructing monolith software bounded contexts for domain driven design

I'm starting to dive into domain driven design for a new project. The software solution will be used by several departments to assign tasks to their employees. The task assignment process is mostly ...
0
votes
1answer
610 views

What is an example giving the difference between Domain Model and Data Model?

I've seen many articles describing differences between Domain Model and Data Model. However none of the articles have picture representations showing difference. https://stackoverflow.com/questions/...