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
4 votes
3 answers
1k 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
32 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
49 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
185 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
364 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
286 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
47 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
1 vote
1 answer
479 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
143 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
109 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
160 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,131
1 vote
3 answers
569 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
243 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
233 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
565 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
708 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
139 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
119 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
0 votes
1 answer
1k 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
  • 103
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 ...
geeko's user avatar
  • 236
0 votes
1 answer
71 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
  • 236
0 votes
2 answers
762 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
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 ...
thomas_p's user avatar
1 vote
2 answers
849 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
2k 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
338 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
272 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
499 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
2 votes
3 answers
1k 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
369 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
704 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,413
1 vote
1 answer
143 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,413
2 votes
2 answers
964 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
42 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
508 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
1k 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
948 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
378 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,413
5 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,413
1 vote
1 answer
2k views

DDD Aggregate in PHP — how to retrieve the root?

Status quo I created an aggregate, let's call it Foo. It has two entities within itself, let's call them Foo & Bar. You can mutate things by calling the aggregate's public methods. E.g. $foo->...
nkamm's user avatar
  • 69
1 vote
0 answers
429 views

DDD - Entity is shared by multiple Aggregates

i wonder what is the correct solution to ensuring consistency of a shared aggregate? Problem statement I try to model the registration at an event with reserved (and limited) seats (like shopping cart)...
Pokerkoffer's user avatar
2 votes
0 answers
1k views

Product, Category, Attributes modelling in DDD

I'm trying to model online shop catalog using Domain Driven Design. There are three main concepts I have right now: Product, Category, Attribute. Attribute is a characteristic of a product. For ...
JoeFerreiro2266's user avatar
1 vote
2 answers
430 views

Is there an equivalent to "aggregate" outside DDD?

Edit 2: Thinking about the problem some more I realized that "Can aggregates be used outside DDD?" was not the right question, hence I changed the title. For the reasons described on the ...
Carlos Coelho's user avatar
3 votes
1 answer
198 views

How to model ordering of Aggregate Roots?

Let's imagine a simple domain model: // aggregate root class TaskList( id: Long, name: String ) // aggregate root class Task( id: Long, taskListId: Long, name: String, dueDate: ...
deamon's user avatar
  • 876
2 votes
1 answer
171 views

Pattern to combine orders from different systems

We have a legacy order system and a new order system that are both currently active. The legacy order system takes 'offline' orders still, the new order system handles 'online' orders but uses the ...
DLT's user avatar
  • 91
-1 votes
2 answers
739 views

Merging aggregates with Event sourcing

I'm currently evaluating Event Sourcing and CQRS for an implementation of a new business requirement at my day job. While I can't really speak about the actual business problem, I can give a few ...
l7r7's user avatar
  • 107