Introduction into
Aggregates

Benifits

  • Easy to build
  • Everyone familiar with such approach
  • Best for CRUD-like applications

Drawbacks

  • Hard to change (high coupling)
  • Mix of read and write responsibilities

Bounded Context

How to Not create an aggregate

<?php

$order = new Order($customer, $orderLines);

Aggregate Root as previous state

<?php

$basket = $customer->pickUpBasket();
$basket->put($product1->reserve(2)); // creates BasketItem
$basket->put($product2->reserve(1)); // creates BasketItem


$order = $basket->proceedToCheckout($shippingInformation);

Saga