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
2
votes
1answer
38 views

Reusing aggregate root key accross 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 ...
0
votes
1answer
39 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
2answers
56 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 ...
2
votes
2answers
48 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
1answer
137 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 ...
1
vote
2answers
131 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, ...
0
votes
1answer
117 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->...
1
vote
0answers
77 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)...
1
vote
0answers
174 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 ...
1
vote
1answer
135 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 ...
3
votes
1answer
86 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: ...
2
votes
1answer
38 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 ...
-1
votes
2answers
96 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 ...
2
votes
2answers
435 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
vote
0answers
62 views

Where to place the Value Object code that is shared by more than one Aggregate Root?

I have 2 Aggregate Root: One is the Lessor user, and the other is the Lessee user. class Lessor extends AggregateRoot {} class Lessee extends AggregateRoot {} Each of these Aggregate Roots has a ...
0
votes
1answer
80 views

How do I deal with multiple repositories for one aggregate?

Suppose I have in my domain model two aggregates: Dog and Cat. Dog is composed of DogName and DogFood. Cat is composed of CatName and CatFood. The repositories, however, are a PetNames API which ...
1
vote
2answers
327 views

When to model an aggregate's entities as part of a value object?

I've read a lot about Domain Driven Design including books from Eric Evans and Vaughn Vernon. So I am familiar with the concepts Aggregate Root, Entity, and Value Object. But while I was modeling ...
3
votes
2answers
200 views

Abstract Factory: Can Client Class have an aggregation with the Factory?

After searching for some Abstract Factory examples using modern programming languages, I have some dillemas about the sensu lato of conceptual UML schema of Abstract, more specificly about the Client (...
3
votes
6answers
310 views

UML aggregation: how can the “whole” exist without its “parts”?

I understand aggregation is a "whole/part" relationship, where the "parent" class is the whole and the "child" class is the part (and this is unidirectional), and that each class exist independently (...
0
votes
1answer
86 views

How to deal with data that seems to be part of multiple aggregates

My head hurts I've been reading about DDD for years and I've now decided to try it in as pure a form as possible. I'm really struggling in general to define aggregates, but this specific problem is ...
0
votes
3answers
2k views

Many to many relations in Domain Driven Design

I am new at domain driven design, and want to learn some about aggregates. For example I have a User and Role entities. public class User { public string Id {get; set;} public string Username ...
1
vote
1answer
763 views

Aggregate root being created by multiple other aggregate roots

I know the title is confusing, I didn't how to word it. I'm studying the Domain Driven Design (DDD) and I'm reading the book "NET Microservices Architecture for Containerized NET Applications" from ...
1
vote
1answer
138 views

Result return types in complex transaction

So, I came upon the code similar to the example below. One thing that bothered me about it was the fact that it's dependent on a Result object being created in the Application Service then passed down ...
0
votes
1answer
373 views

How to determine aggregates when entities are shared?

So I'm trying to figure out exactly what my aggregates/aggregate roots are in my structure, and can't seem to wrap my head around it. Database contains the following tables: SALESGROUP ID ...
1
vote
2answers
283 views

Does references between entities of the same aggregate hurt the Aggregate Pattern from DDD?

Consider an application being implemented following Domain Driven Design. In the same aggregation, there are Car and Computer entities that should have a one to many relationship between them (Car ...
2
votes
0answers
55 views

Commiting transaction in the repository instead of the application service

After quite some time thinking about it, and testing both methods, I'm really struggling with choosing the right manner to commit my transactions. To shape the context, we are in the context of ...
0
votes
1answer
92 views

if two entities need to be created at the same time does this make them a DDD aggregate

Scenario I have a Customer and a CustomerSettings object. When I create a customer I also need to create their CustomerSettings object. These settings can dictate the customer experience immediately ...
-1
votes
1answer
170 views

Enforce invariants spanning multiple aggregates

Good day, Please help me solve the dilemma. I am trying to write an e-commerce engine relying on DDD. Problems associated with two aggregates, ProductType, and Product. Product is a classic product ...
0
votes
3answers
418 views

Application architecture using CQS and DDD Aggregates

I am working on a microservice architecture using CQS and with domain objects built using DDD aggregates. I am just beginning to learn about CQS, CQRS, Domain Driven Design, so excuse me if what I ...
2
votes
1answer
330 views

DDD - how to model an aggregate using data from 2 other aggregates to make a business decision

I'm stumbling trying to find a proper way to model this scenario: I have 3 different aggregates within same Bounded Context: A Student A University A University of Interest public class Student : ...
3
votes
3answers
896 views

DDD - operation on one aggregate that creates another aggregate

Let's say I am designing a TODO application and therefore have an aggregate root called Task. The business requires to keep a list of TaskLogEvent that provides them with a history of how the task ...
0
votes
1answer
73 views

Storing within the domain or use CQRS?

Assume we're building a fleet management system that is monitoring telemetry on a fleet of cars. Important telemetry include like location, speed and engine temperature. Metrics are mostly dynamic and ...
0
votes
1answer
107 views

Keep all user orders in a single aggregate instance

I'm thinking of not keeping user orders as separate Aggregate instances, but combine them into one UserOrders. Is such an approach going to have some flaws in terms of DDD? Along with orders, I would ...
-2
votes
1answer
405 views

A basic question on DDD aggregates order and payment

There's is a statement from https://martinfowler.com/bliki/DDD_Aggregate.html: An aggregate will have one of its component objects be the aggregate root. Any references from outside the aggregate ...
1
vote
2answers
283 views

F# DDD Bank Modelisation: Aggregate Design for Event Sourcing

I am designing a toy project dealing with the bank account management in F# with Event Sourcing. I would like to get a bit of review (not really a code review) about my Commands and Events to see if ...
0
votes
1answer
131 views

Using the same entity for different use cases

Suppose I have a User entity with name and age attributes. A User can own Boxes. A Box has the name and color attributes. Business rules dictate that one User can own at most 5 boxes. So, in this case,...
1
vote
2answers
596 views

DDD different aggregates for the same model but different sagas / use cases?

I have an invoice aggregate that I create with a lot of data: $invoice = Invoice::create( InvoiceId::generate(), $lines, // Collection of lines InvoiceNumber::create('1'), $address, //...
2
votes
1answer
591 views

DDD - Creating and modifying my root aggregate based on request data

I have an invoice root aggregate that has many invoice line entities, a due date value object and two reminder entities. We're not using event sourcing yet. The post data I receive from the form the ...
0
votes
2answers
732 views

performance suggestions on Aggregate root containing thousands of child entities

I understand that DDD is a design concept and implementation through ORMs are tricky but help me understand how would you solve this problem? So here is my confusion on changing on aggregates only ...
0
votes
1answer
69 views

Can Aggregate shared between services?

I am working in an event-sourcing architecture and while creating the aggregates I came to an interesting challenge, disclaimer I'm new to this. I have a UserAggregate encapsulating the logic for ...
0
votes
1answer
175 views

Modify a property of an aggregate's entity

Suppose I have a house-lending service, like Airbnb. I have a House entity, which can have a name. There's also the Reservation entity, which has a start date, an end date, and a name (which isn't ...
0
votes
0answers
261 views

DDD: aggregate root and references to child entities

I'm struggling a bit to grasp all DDD concepts and apply them to a real project. Let's say I have the following domain concepts: Car: a vehicle moving inside an area Path: a journey made by a car, ...
0
votes
1answer
607 views

DDD: Aggregate with nested childs

I have a CategoryClass (Aggregate root) -> SubCategoryClass -> and now a relational entity (n-n). Category (root) 1->N SubCategory 1->N SubCategorySlotType (n-n) SlotType (root) My SubCategory only ...
2
votes
1answer
902 views

A problem with understanding aggregates and aggregate roots in Domain Driven Design (DDD)

I've stumbled upon a problem: "I can't split my domain models into aggregate roots". I'm a junior developer and novice at DDD. I really want to understand it, but sometimes it's really confusing. ...
2
votes
1answer
596 views

DDD Aggregate with Catalog Product

I'm new to DDD and I'm trying to figure out the aggregate root. I'm sure this question has been asked a million times. So I have : Products (thousands) Catalogs (hundreds) CatalogEntries that ...
3
votes
1answer
2k 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 ...
1
vote
1answer
970 views

DDD - how to model validation and enforce invariants that possibly resides in different aggregates

I have two models in my current design, student and group. Student and group are both aggregate roots. A student can be added to a group (method on group aggregate root), and it can be active for ...
1
vote
3answers
1k views

Domain Events, CQRS, and dependency resolution in handlers

Currently: ASP.NET Core 2.2. I've been doing quite an extensive research in this topic (Domain Driven Design used together with Clean Architecture): DDD: Where to place domain event handlers? And I'...
1
vote
1answer
289 views

DDD: Re-assign an entity from one aggregate to other

Let's pretend I have an 'Book' entity, that can contain many 'Chapter' entities, having both their own unique IDs. A chapter must belong to a book, it cannot exists on its own (ie: there is a required ...
0
votes
1answer
62 views

Should I have two identical classes in two different aggregate roots?

I have an application that is modifying some XML files. Two of the files have a similar structure, with similar business logic needed to be implemented on them. I've realized that there are some ...