Questions tagged [aggregate]
An aggregate is either a group of related objects/data or the result of some operation on such group. The tag can be used for example for language specific data structures, algorithms that combine data and GROUP BY queries, UML relationships, or DDD aggregates that combine dependent objects.
171 questions
1
vote
1
answer
80
views
Aggregate design for a fuel tank with deliveries and fill level readings
So I've got a rather simple, mostly crud application I want to use DDD with, to learn/practice it. I wonder about aggregate design regarding a fuel tank entity. Each tank stores fill level readings (...
1
vote
2
answers
214
views
Pattern / Architecture to implement State Machine with "steps" between states
I'm looking for some guidance implementing the following problem:
We have a set of 'states' which a user can enter into:
1.- Registered: A user registers themselves in the system and can start placing ...
2
votes
2
answers
173
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 ...
0
votes
0
answers
139
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 ...
1
vote
2
answers
175
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 ...
1
vote
3
answers
231
views
What are the DDD aggregates in package delivery system?
I'm trying to model a specific domain using DDD techniques and have some doubts. To better contextualize, a brief description:
It's a domain of deliveries and delivery confirmation. We have two main ...
2
votes
2
answers
176
views
Child Entity or Aggregate Root?
I have to design a part of a system in responsible for creating tickets for attractions and then sell them. Basically there are
three different parts:
Product: to create the tickets for sale for each ...
1
vote
5
answers
841
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, ...
4
votes
3
answers
2k
views
Can two different kind of aggregates in Domain Driven Design have actually the same unique Id?
Assume that we are doing aggregate design for a ride hailing application and we have created the following aggregates: DriverAvailability aggregate, which has a value object containing the status (...
0
votes
0
answers
180
views
Event sourcing, bulk update and storing multiple events vs one event with multiple ids
Event-sourcing often implies to have one row per aggregate id :
event_id
event_type
entity_type
entity_id
event_data
102
OrderCreated
Order
101
{...}
103
OrderUpdated
Order
101
{...}
This is ...
2
votes
1
answer
394
views
Avoiding modification of multiple aggregate roots in one transaction
I'm modelling a scheduling application and wonder how it could be avoided to update multiple aggregate roots (AR) in one transaction. I understand the fundamental problem of changing multiple ARs in ...
0
votes
2
answers
585
views
What if a Repository needs to apply Business Logic to load an Aggregate?
I have an aggregate User and the user has a Score. The Score of a user is calculated by queriying a bunch of different tables and running through (often very large) result sets applying some business ...
0
votes
1
answer
402
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
...
0
votes
0
answers
66
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. ...
2
votes
1
answer
972
views
DDD - Modelling a system of groups and users
I'm looking for some advice on a system I'm designing, at its core it will allow users to create/join/manage groups of users.
I thought it would be a good idea to try and apply some DDD principles, ...
0
votes
0
answers
191
views
DDD modeling with subtypes
I recently started learning about DDD and I'm in the process of designing a solution for an Auction module the issue I'm facing is that the different types of auctions have different characteristics ...
1
vote
1
answer
159
views
How to model your domain when having subtype?
I recently started learning about DDD and I'm in the process of designing my first solution.
I have a business requirement to design solution for Auction module and there are many types of auctions ...
1
vote
1
answer
248
views
How do I identify ways to break apart an Aggregate that has become my entire application?
I am developing an algorithmic trading framework using DDD/event-driven principles. I've decided the following components sit within my bounded context:
Data feed -> [Entry Point] -> "...
1
vote
3
answers
821
views
Aggregates and control over children
Let's say you are performing a PUT request on an endpoint for a resource that holds a list of entities. For example, a football team and it's players. It would be fair to say that the list of players ...
0
votes
0
answers
264
views
Domain-driven Design: Aggregate root property is a collection of other independent aggregate roots
In my domain model I've got two principal entities: User and Event, both which I've decided to make aggregate roots. Users and Events have a one-to-many relationship wherein Users can create several ...
3
votes
2
answers
3k
views
How to update "big" aggregatess in DDD
In my domain there's a part where I have a root entity, with some fields, and then some other entity inside that aggregate, like this:
class AggregateRootEntity {
... some fields ...
Entity ...
1
vote
4
answers
323
views
Dilema about having a Country, Province, City model separate Aggregate or in the same aggregate
We are porting an old monolith application and we are trying to apply the DDD concepts, we started looking for what we think are the Bounding Contexts of the application.
We have what we thought would ...
0
votes
1
answer
836
views
DDD - model and enforce invariants for workflow engine
I'm trying to design a workflow engine using a DDD approach.
Context
(B1) Assign items to a workflow
Invariant: depending on their types, items can only start the workflow on specific steps.
(B2) ...
3
votes
2
answers
1k
views
Maintaining referential integrity between Aggregate Roots
In his book "Implementing Domain-Driven Design" Vaughn Vernon suggests to reference aggregate roots only by ID. I see the following advantages of this approach:
It is clear where the ...
0
votes
0
answers
183
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 - ...
1
vote
4
answers
136
views
Class Diagram - Aggregating over a class that has physical presence or logical presence?
In the below figure, a CD shop has CD cupboards, and inside it has shelves. CDs could be rented, and class CD Copy represents the actual CDs that are rented. My question is, should I represent Shelves ...
1
vote
1
answer
2k
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 ...
4
votes
3
answers
4k
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 ...
0
votes
1
answer
83
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 ...
0
votes
2
answers
1k
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 ...
5
votes
2
answers
5k
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 ...
1
vote
2
answers
1k
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 ...
0
votes
2
answers
3k
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 ...
3
votes
1
answer
569
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 ...
1
vote
1
answer
446
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 ...
0
votes
0
answers
557
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 ...
0
votes
3
answers
3k
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 ...
3
votes
3
answers
2k
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 ...
0
votes
2
answers
464
views
Is there alternative to applying events synchronously in command handler in CQRS?
I have workflow where I have complex command handlers encapsulated inside aggregate. These handlers emit some events, and then further logic based on result of these events can emit more events. ...
3
votes
2
answers
935
views
Read-only view to reference other Aggregate Roots
In his book Implementing Domain-Driven Design Vaughn Vernon suggests to reference other aggregate roots only by identity and not by reference, like this:
// Aggregate Root
class Order(
val ...
0
votes
3
answers
3k
views
How can I coordinate updating multiple Aggregates as a result of one command, without introducing exploitative possibilities?
I'm trying to figure out how to integrate one command that updates multiple Aggregates in different contexts in a video game. The components/considerations for my particular design are DDD, CQRS, ...
1
vote
1
answer
209
views
Can objects outside the Application Layer hold references to Aggregate Roots
Reading Domain-Driven Design, on the section of Aggregates, it says
The root is the only member of the Aggregate that outside objects are
allowed to hold references to, although objects within the ...
5
votes
2
answers
1k
views
Domain driven design model version
sorry for the long question, but I love DDD but there is a problem I can't seem to resolve.
We have a problem when adding business rules to the aggregate root.
Our architecture is mostly like this ...
0
votes
0
answers
62
views
Should aggregated data include meta data?
I want to create a aggregation job that executes a big db query and flush it into BigQuery.
My question is should I include only the id of the entities (campaign id, advertiser id, user id) or should ...
2
votes
1
answer
586
views
Reusing aggregate root key across bounded contexts?
As the question states, is this bad practice?
I have a User aggregate root in the bounded context of Identity for authenticating the user. In this bounded contexts I have fields for the User related ...
1
vote
1
answer
2k
views
Bulk Update of DDD Aggregate Roots
In my applications users can perform actions on a few thousand aggregate root instances with a single click. The problem is that the UI is blocked for several seconds (~ 3) what feels too slow. So, I'...
1
vote
2
answers
1k
views
Composite Id based on another Aggregate root?
An Aggregate Root should always have a unique ID within the bounded context. Typically the examples one finds use a GUID for this to ensure global uniqueness.
However consider a bounded context for a ...
1
vote
2
answers
2k
views
Relationship between entities in different aggregates and size of aggregate
I read a lot about DDD but few thing are still unclear. At this moment I have two dilemma
The size of aggregates. How small could be an aggregate?
For example we have:
class Car {
String colorId
...
2
votes
1
answer
613
views
With DDD, how can we model Entities that exist only as an Identity?
In my Domain, I have numerous objects that are expressed by Identity alone. Specifically, several of my Subdomains exist only to represent something that has been created.
For example, in a video game ...
6
votes
2
answers
3k
views
In DDD Aggregate + Event Sourcing, do Events happen before or after state changes?
Part of the Aggregate + Event Sourcing (A+ES) methodology feels
uncomfortable.
Why does it feel uncomfortable? (As I've read from other questions and the book itself, it's a new-ish way of thinking, ...