Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
38 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 ...
Pablo's user avatar
  • 101
2 votes
2 answers
136 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 ...
Philipp Murry's user avatar
0 votes
0 answers
102 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 ...
Mush-A's user avatar
  • 109
1 vote
3 answers
131 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 ...
securita's user avatar
1 vote
3 answers
177 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 ...
Eduardo Albuquerque's user avatar
2 votes
2 answers
151 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 ...
Tobías's user avatar
  • 251
1 vote
5 answers
512 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, ...
MatTheCat's user avatar
  • 119
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 (...
Antonis's user avatar
  • 149
0 votes
0 answers
108 views

How to Structure Search Facets on Dynamic Fields

I am responsible for implementing search functionality for our web application; I take search text from a user and come up with a list of products, score them, and return them to display to the user. ...
Groger's user avatar
  • 113
0 votes
0 answers
126 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 ...
djflex68's user avatar
2 votes
1 answer
306 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 ...
deamon's user avatar
  • 876
0 votes
2 answers
542 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 ...
Mats's user avatar
  • 163
0 votes
1 answer
357 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
0 votes
0 answers
54 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
2 votes
1 answer
770 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, ...
Astronought's user avatar
0 votes
0 answers
171 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 ...
khalil Berakdar's user avatar
1 vote
1 answer
138 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 ...
khalil Berakdar's user avatar
1 vote
1 answer
188 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] -> "...
MikeRand's user avatar
  • 1,133
1 vote
3 answers
736 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 ...
apriestley's user avatar
0 votes
0 answers
259 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 ...
Charybdis's user avatar
3 votes
2 answers
2k 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 ...
Antonio Gamiz Delgado's user avatar
1 vote
4 answers
299 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 ...
mmas's user avatar
  • 33
0 votes
1 answer
746 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) ...
freakmind's user avatar
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 ...
deamon's user avatar
  • 876
0 votes
0 answers
162 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 - ...
devmr97's user avatar
1 vote
4 answers
129 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 ...
Melanie A's user avatar
  • 339
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 ...
ainsausti's user avatar
  • 113
4 votes
3 answers
3k 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 ...
geeko's user avatar
  • 246
0 votes
1 answer
77 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 ...
geeko's user avatar
  • 246
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 ...
deamon's user avatar
  • 876
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 ...
thomas_p's user avatar
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 ...
Mazen Elkashef's user avatar
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 ...
Jesse's user avatar
  • 193
2 votes
1 answer
453 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 ...
Jesse's user avatar
  • 193
1 vote
1 answer
373 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 ...
Jesse's user avatar
  • 193
0 votes
0 answers
535 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 ...
Jesse's user avatar
  • 193
0 votes
3 answers
2k 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 ...
lamb_bd85's user avatar
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 ...
Tâmer Cuba's user avatar
0 votes
2 answers
452 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. ...
chris's user avatar
  • 101
3 votes
2 answers
840 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 ...
deamon's user avatar
  • 876
0 votes
3 answers
2k 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, ...
Zymus's user avatar
  • 2,473
1 vote
1 answer
186 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 ...
Zymus's user avatar
  • 2,473
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 ...
bachibusuc's user avatar
0 votes
0 answers
49 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 ...
Avi L's user avatar
  • 109
2 votes
1 answer
546 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 ...
udnes99's user avatar
  • 59
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'...
deamon's user avatar
  • 876
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 ...
udnes99's user avatar
  • 59
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 ...
pin54's user avatar
  • 19
2 votes
1 answer
568 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 ...
Zymus's user avatar
  • 2,473
6 votes
2 answers
2k 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, ...
Zymus's user avatar
  • 2,473