Design Course !!hot!! — Domain Driven

When Order is confirmed → raise OrderConfirmed → trigger PaymentProcess → InventoryReserved

add(other: Money): Money { if (this.currency !== other.currency) { throw new Error('Currency mismatch'); } return new Money(this.amount + other.amount, this.currency); } } class Order extends AggregateRoot { private lines: OrderLine[] = []; private status: OrderStatus = 'Draft'; addProduct(productId: string, quantity: number, price: Money) { if (this.status !== 'Draft') { throw new Error('Cannot modify confirmed order'); } const line = new OrderLine(productId, quantity, price); this.lines.push(line); } domain driven design course

Complexity, eventual consistency, event versioning When Order is confirmed → raise OrderConfirmed →