Skip to main content
InterviewHubPRO
Section Overview
Q7

Question 7 of 50

Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

14%
Domain-Driven Design (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

What is an Aggregate and an Aggregate Root?

junior Leveldomain-driven-designBasic

In Simple Words:

  • Aggregate: A cluster of associated domain objects (Entities and Value Objects) treated as a single unit for data changes and transactional consistency:
    • Example: An Order (Aggregate Root) containing multiple OrderItem entities and a ShippingAddress value object.
  • Aggregate Root: The single master Entity that serves as the only gateway to the aggregate:
    • Outside code CANNOT reference or modify internal child entities directly (e.g. code cannot directly modify an OrderItem).
    • All operations must pass through methods on the Aggregate Root (order.addItem(), order.cancel()), allowing the root to enforce business invariants.