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
1 answer
1k views

Using Event Sourced Aggregate Roots with the Specification Pattern

I have a Aggregate Roots that use the event sourcing technique of being built from a series of events in a Repository. This is all great for when I just need to manage change of state etc, but when I ...
user avatar
2 votes
2 answers
2k views

Can one Aggregate Root have multiple subtypes

I have a concept that I am struggling to design in a DDD CQRS manner, and I hope to find some insight. In the old days (before I knew DDD) I would have used simple inheritance, and that's how my mind ...
user avatar
7 votes
3 answers
2k views

Balance between aggregate boundaries and domain consistency in DDD

Designing an Aggregate and choosing an Aggregate Root getting tricky for me all the time especially when it comes to ensuring right transactional contexts and consistency constraints so I'm wondering ...
user avatar
  • 431
8 votes
1 answer
4k views

Updating nested objects in DDD Aggregate by example: delegation or direct access from the root?

The example domain problem There is a student attendance tracking system that keeps records of student attendances of ExerciseGroups. Course is a top-level component, AR, describes a generic info ...
user avatar
  • 431
-2 votes
1 answer
154 views

Filling in background information in terms of DDD

Recently, I asked about my difficulties in finding the boundaries of aggregates here and I recently reinterpreted it and rid it of business features and now it sounds like this: In many sources, ...
user avatar
  • 133
11 votes
2 answers
3k views

How to design the aggregate boundaries?

I would like to write an application something like ecommerce. And you know that in similar applications products could have different properties and features. To simulate such an opportunity I've ...
user avatar
  • 133
4 votes
1 answer
956 views

DDD - Domain Modelling association between aggregates

I have a bit of a mental block when trying to model my scenario whilst practicing DDD. The problem appears to be around 2 entities you would consider to be aggregate roots. I feel these aggregate ...
user avatar
  • 249
4 votes
3 answers
5k views

DDD - Aggregate inheritance and repositories, how to correctly design this situation?

I'm working on a legacy warehouse system. There is one Aggregate root, Product which has its correspondent ProductRepository. Right now I have a new requirement that says the following: Some Products ...
user avatar
1 vote
1 answer
2k views

DDD integrating aggregate root with open host service (OHS)

Here is the case: according to ubiquitous language - payment can be sent for processing to payment gateway (which is in different bounded context integrated via ACL (anti-corruption layer) + OHS/PL) ...
user avatar
  • 217
1 vote
0 answers
149 views

Collecting sports data from many sources in many formats

I'm trying to solve a problem that exists for a sport. The sport is fragmented into many federations, and each federation is completely isolated from other federations. The sport is the same for each ...
user avatar
  • 121
3 votes
0 answers
1k views

DDD problem with aggregate design (users, authentication)

We're having a bounded context dealing with payments. I'm trying to model case, where Merchant can create another merchant and inherit some of its properties in this case: users that are needed for ...
user avatar
  • 217
3 votes
2 answers
4k views

Handling aggregate root with deep object hierarchy

What is the correct way to apply commands to objects deep within the model hierarchy? Given the following model: public class Picture : AggregateRoot { private string title; private List<...
user avatar
  • 141
8 votes
3 answers
6k views

Can there be multiple aggregates for the same concept?

Say I have the concept of a User; a very basic structure in reality. If the business requires that an aspect of the software needs to display all related 'Posts' for example, how should that be ...
user avatar
0 votes
2 answers
1k views

DDD: How to avoid breaking encapsulation and leaking technical concerns to the domain during model rehydration?

When applying DDD principles in Ruby, I feel that Active Record pattern ends up polluting the domain model, while I'm not sure how to implement JSON deserialization without breaking encapsulation. ...
user avatar
2 votes
1 answer
116 views

Should this behavior be modeled as an entity or domain service?

Imagine that you're modeling SE (or SO) on DDD. You decided to implement the "board" as an aggregate root. So the board has the method AddNewQuestion(string question). There are business rules that ...
user avatar
  • 364
6 votes
1 answer
1k views

How can I avoid a cross aggregate transaction?

Consider this simplified example: In an online ticket sale website, tickets have variable prices that change over time. User searches for tickets. Once he finds a ticket he wants, clicks "Buy" and ...
user avatar
1 vote
1 answer
597 views

How to effectively store aggregates in actor model

I'm struggling with aggregates in actor model (akka) and how to store their state. I wonder what role does repository stands for in actor model in DDD. I have a situation, where my aggregate root ...
user avatar
  • 217
0 votes
2 answers
776 views

Should the Application Service in DDD use references to non-root entities and value objects inside an aggregate?

I understand that objects external to an aggregate shouldn't hold references to entities and value objects belonging to the aggregate. My question if this also applies to the Application Service that ...
user avatar
2 votes
2 answers
267 views

How should I approach instantiating a UUID from another aggregate

Forgive me if this is a truly naive question, I can't find an answer anywhere (which makes me think it is maybe silly and naive). If I am to hold a reference to an aggregate inside another, I of ...
user avatar
4 votes
1 answer
1k views

DDD: are objects that represent "aggregate roots" must be unique (singleton-like)

I'm developing my first application using DDD and event sourcing. From what I understand, aggregate encapsulates specific domain functionality with one or more associated invariants. The invariants ...
user avatar
  • 151
2 votes
1 answer
1k views

How to query a child object within an aggregate root on demand?

I'm learning DDD. For a practice, I'm trying to convert my own app to DDD aggregates. What I understand so far on aggregate. Aggregate defines transactional boundary Design aggregate as small as ...
user avatar
  • 515
0 votes
1 answer
808 views

CQRS - Passing aggregate root as argument

So, I have following code: public class CQRSQuestion { public static void main(String[] args) { //received command for algorithm run AlgorithmAR algorithmAR = new AlgorithmAR(...
user avatar
1 vote
1 answer
1k views

Aggregate relationships in Domain Driven Design

I have a question related to relationships between aggregates in Domain Driven Design. I have the following situation: I have an aggregate (questionnaire) which has some children (questions). The ...
user avatar
3 votes
1 answer
1k views

How does the Aggregate Root concept and the Repository Pattern solve DRY in database operations?

If I have ten classes, and they all need CRUD operations, how does an Aggregate Root and the Repository Pattern solve me having to write lots of boilerplate code (the DRY)? Take the example of a ...
user avatar
  • 3,629
6 votes
1 answer
1k views

Event sourcing - applying events before change is done?

So, I have Aggregate root that has some sub-entities with some sub-value objects (classic DDD design). I wanted also to use Event sourcing in Aggregate design. In AppService layer I receive Command, ...
user avatar
2 votes
1 answer
1k views

Sharing of event source stream between aggregates

I have a question related to cqrs + event sourcing. I have two aggregate roots (AR1 and AR2). When AR1 received a command/event it will be recreated from previous event sourcing stream from repository ...
user avatar
4 votes
2 answers
458 views

Domain Events Grouping/Buffering

Suppose I have 3 domain events, Event1 Event2 and Event3. When command arrives at my Service Layer, I can rise 2 commands at the same time - e.g. Event1 and Event2. One Class has event listener for ...
user avatar
4 votes
1 answer
4k views

Rest API calls with side effects on other resources

Let's say I have a mobile app, android/iOS and a java Spring back end. Given the mobile connectivity, the number of network round trips must be limited, ideally, 1 or less per screen. Now, let's say ...
user avatar
  • 641
3 votes
2 answers
368 views

Is accessing lower tier members of an aggregate to perform an operation bad practice?

I am currently building a small project that is supposed to keep track of recipes. Each recipe has a bunch of information, including a rating for said recipe. Since the rating has some additional ...
user avatar
1 vote
1 answer
173 views

Got confused while designing Aggregates

I am designing an application, which will store sports statistics, show them in different diagrams and do few more operations on them. Allow user to do some mock drafts etc. I choose to build a ...
user avatar
  • 11
6 votes
2 answers
2k views

Recreating complex aggregates from a persistance source

I'm building a web application with C#, and I have an aggregate root which has several entities and value objects. Then I have a repository object which persists the aggregate to the database (I'm ...
user avatar
2 votes
1 answer
201 views

Which layer should convert timezones given querying on aggregate tables?

I'm running a Django application service with an API that feeds to a javascript frontend. The data is specifically for charts and graphs, so the data that is returned is a fairly large json with every ...
user avatar
  • 2,629
1 vote
1 answer
955 views

DDD aggregate and component structure [closed]

What do you consider that is there relationship between DDD aggregate and architectural component? I think that it is quite reasoned that services, which are related to specific aggregate, defined a ...
user avatar
  • 521
0 votes
1 answer
338 views

What is a Collection of Aggregates Referred to in Domain Driven Design?

E.g. in a domain model with two aggregate roots: book author Is there a specific term that refers to a collection of aggregates of the same root type (e.g. a collection of books)? In Confusion ...
user avatar
  • 103
11 votes
3 answers
4k views

Confusion about the meaning of the word aggregate in domain driven design

In a discussion about domain driven design I have learned the different people seem to think of different things when using the word aggregate. The main difficulty is that some people use the word ...
user avatar
4 votes
1 answer
1k views

Aggregate root with many fields

I'm struggling with this problem for a long time now. Lets say that I'm trying to model some business that has Customers, Companies, Contracts, Invoices etc. All of them looks like good candidate for ...
user avatar
  • 163
1 vote
1 answer
96 views

Confusion on aggregate root

Let's say I have the following entities. Product, Option, and OptionValue Product can be created without any options. Option must include at least one OptionValue OptionValue can be created without ...
user avatar
  • 515
1 vote
0 answers
221 views

Data Store Design for NxN Data Aggregation

I am trying to come up with a theoretical solution to an NxN problem for data aggregation and storage. As an example I have a huge amount of data that comes in via a stream. The stream sends the data ...
user avatar
  • 111
3 votes
2 answers
208 views

Enforcing aggregate rules in purchase management domain

I'm having problems defining the aggregate boundaries (and maybe even the aggregate root) to enforce the transactional consistency rule. Let me first describe the problem domain. In our domain we ...
user avatar
0 votes
0 answers
66 views

How to model relationships in scenario where every product can (don't have to) be associated to only one category

This one still occupies my mind. How do you model 1:N relationships. Consider having a category and product (typical e-commerce scenario). Every product can (don't have to) be associated to only one ...
user avatar
1 vote
1 answer
499 views

Loading Aggregate Root from Database with Validations

Here is a similar question Where to validate domain model rules that depend on database content? I am asking this new question because I have more descriptions and I don't want to change the ...
user avatar
4 votes
1 answer
2k views

DDD – duplicity between Aggregates – should I use one table?

I understand that there exists duplicity of data between Bounded Contexts. The thing is that I'm not really sure about duplicity of data between Aggregate roots. Example: I have product in Product ...
user avatar
6 votes
4 answers
9k views

Domain driven design, can two aggregates have the same root?

For the purpose of separating different functionality into different classes, I have two following Aggregates: ActiveEmployee AssignTask () ReassignManager () Deactivate (string reason) ...
user avatar
  • 163
6 votes
2 answers
6k views

how to paginate and combine results that come from different sources sorted

I have the following scenario: I have a user that needs to see some news feeds from different sites and I want to paginate them and sort them by date. The problem is I don't understand how to do ...
user avatar
2 votes
1 answer
1k views

Inter-aggregate commands/transactions in an eventual consistency manner

I am trying to model a business transaction that operates on two aggregates. Let's say we have a Bag aggregate type that contains Items (entities). I would like to have a command TransferItemToBag(...
user avatar
  • 293
3 votes
2 answers
6k views

Collection vs data structure vs aggregate

I know three terms that have to do with storing objects or data. I'm not sure I understand the exact differences between the terms. Please confirm if what I'm about to write is accurate. A data ...
user avatar
  • 20.7k
0 votes
1 answer
296 views

Aggregate Boundary repository/service design

I am trying to apply DDD to the design of a Release Management system. Domain Entities Project: The project/product/system. ProjectEnvironment: The environments (Test, Staging, Prod) that exist ...
user avatar
  • 877
1 vote
2 answers
2k views

Data Aggregation of CSV files java

I have k csv files (5 csv files for example), each file has m fields which produce a key and n values. I need to produce a single csv file with aggregated data. I'm looking for the most efficient ...
user avatar
  • 227
1 vote
1 answer
392 views

pre aggregating documents mongodb

In our current setup, most of our database calls are updates where we increment a key by 1. If all one is doing is incrementing certain keys on a document (a lot) in mongodb, and there are several ...
user avatar
  • 297
-1 votes
1 answer
1k views

Data aggregation like polyvore.com [closed]

I'm creating a website that is going to aggregate women shoes from across the web into one website. Kinda like polyvore.com does with all their products but mine is only going to be shoes. Which ...
user avatar
  • 107