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.

An aggregate may refer to:

  • a data structure composed of several other data structures. For example, struct, class, arrays are aggregates. Programming language specifications may restrict the usage of the term (e.g. C++ uses the term aggregate only for such structures that have no private/protected members, no base class and no virtual function, refer to ISO C++ section 8.5.1).

  • data obtained by combining data using grouping, statistical operations, and machine learning. For example you can count, average, sum data with SQL GROUP BY. Such data can be stored in data warehouse models to accelerate multidimensional analysis. By extension the term may also be used to designate aggregate functions

  • a class that has an aggregation relationship other classes (UML). Typically, an aggregation represents a "whole/part" or a "has-a" relationship, in which the parts are independent of the aggregate (e.g. they could be shared between different aggregates).

  • a group of objects that can be treated as a single unit and accessed via a root object (Domain Driven Design)

164 questions
56
votes
6 answers

Are DDD Aggregates really a good idea in a Web Application?

I'm diving in to Domain Driven Design and some of the concepts i'm coming across make a lot of sense on the surface, but when I think about them more I have to wonder if that's really a good idea. The concept of Aggregates, for instance makes sense.…
Erik Funkenbusch
  • 2,768
  • 3
  • 22
  • 27
12
votes
2 answers

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 created the following domain model…
cephei
  • 143
  • 1
  • 8
12
votes
3 answers

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 aggregate for what other people call aggregate…
Sjoerd222888
  • 669
  • 5
  • 18
10
votes
3 answers

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 whether there are any practices that can make it…
9
votes
2 answers

DDD - Domain events vs application events

I'm considering two types of notifications: Domain events used internally within a bounded context Application events used to exchange notification messages between bounded contexts Each aggregate in my bounded context defines its own…
8
votes
3 answers

DDD: Is an aggregate root responsible for deleting its child entities from their repository?

I am developing a large software project using DDD (Domain-Driven Design). I have an entity that acts as an aggregate root, let's call it Root. This entity refers to a collection of child entities of the type Child. Because the use of this Child…
Subsurf
  • 231
  • 1
  • 3
  • 6
8
votes
4 answers

DDD: Identifying aggregate root in a simple example application domain

I'm trying to read about DDD, and i'm struggling a bit trying to to identify aggregate roots. I wrote a really simple app to divide players into different teams inside a game. So my entities are something like this: Game Entity: public class Game :…
8
votes
1 answer

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 about the learning course (name, description) Every…
8
votes
3 answers

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 are Purchasable and need to keep track of the…
8
votes
3 answers

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 modelled? Should there be posts as an attribute on the…
designermonkey
  • 383
  • 4
  • 11
8
votes
4 answers

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) InactiveEmployee GetReasonForDeactivation () Reinstate…
omittones
  • 183
  • 1
  • 1
  • 6
8
votes
3 answers

DDD - Aggregate Roots - Dealing with Efficiency and Concurrency

First off, I'll admit that I'm a newbie to DDD and need to read the "blue book". I'm building a system that has an AggregateRoot of type "Match". Each Match can have a collection of "Votes" and also has a readonly "VoteCount" property which gets…
drogon
  • 334
  • 3
  • 8
7
votes
3 answers

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 changed over time. As the Task may have hundreds of…
Juraj Mlich
  • 193
  • 1
  • 5
7
votes
1 answer

DDD - How to avoid overlapping aggregate boundaries?

I recently started reading Evan's book about DDD, and I decided to try and apply some of the principles from that book on a bounded context of a project I've been working on. The context of interest deals with appointment and appointment…
Stefan Rendevski
  • 386
  • 2
  • 11
7
votes
2 answers

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 that schemantically. Fetch top-N from each site and…
arisalexis
  • 409
  • 3
  • 10
1
2 3
10 11