Code AnalysisHard 60s
Analyze: aggregate invariant leak
Which principle is violated by exposing this setter chain?
class Order: // aggregate root
items: List[OrderItem]
class Service:
addItem(orderId, item):
o = repo.find(orderId)
o.items.add(item) // mutates internal collection directly
repo.save(o)
// invariant: total items must never exceed 50
Think you can answer under pressure?
Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.