You are designing a DDD model for an online store. Which of the following best represents an Aggregate?
hard📝 Trade-off Q15 of 15
LLD - Advanced LLD Concepts
You are designing a DDD model for an online store. Which of the following best represents an Aggregate?
AAn Order object that contains multiple OrderItems and enforces business rules
BA single Product object with price and description
CA database table storing customer addresses
DA utility service that calculates discounts
Step-by-Step Solution
Solution:
Step 1: Understand Aggregate in DDD
An Aggregate is a cluster of related objects treated as a single unit with a root entity controlling consistency.
Step 2: Match options with Aggregate concept
An Order object that contains multiple OrderItems and enforces business rules describes an Order with multiple OrderItems and business rules, fitting Aggregate definition.
Final Answer:
An Order object containing multiple OrderItems and enforcing business rules -> Option A
Quick Check:
Aggregate = root entity + related objects [OK]
Quick Trick:Aggregate = root entity plus related objects as one unit [OK]
Common Mistakes:
Confusing single entities with aggregates
Thinking utility services are aggregates
Mixing database tables with domain aggregates
Master "Advanced LLD Concepts" in LLD
9 interactive learning modes - each teaches the same concept differently