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
0answers
37 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
4answers
89 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 ...
0
votes
1answer
93 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 ...
3
votes
3answers
369 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
1answer
63 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 ...
1
vote
1answer
67 views

Obtaining application generated ID from repostory 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 ...
3
votes
2answers
449 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 ...
0
votes
2answers
195 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
2answers
155 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 ...
1
vote
1answer
62 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
1answer
30 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
0answers
87 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
3answers
304 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 ...
2
votes
3answers
214 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
2answers
170 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. ...
2
votes
2answers
117 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
3answers
341 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
1answer
54 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 ...
2
votes
2answers
241 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
0answers
19 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
1answer
96 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
1answer
369 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
225 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
2answers
394 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
202 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 ...
3
votes
2answers
507 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
387 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
195 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)...
2
votes
0answers
538 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
169 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
96 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
66 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
311 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 ...
4
votes
2answers
2k 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
205 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
141 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
1k 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
292 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 (...
4
votes
6answers
817 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
107 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
4k 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
2k 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
146 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 ...
1
vote
1answer
926 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
549 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
95 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
174 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 ...
0
votes
1answer
270 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 ...
1
vote
3answers
677 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
637 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 : ...