Aggregates and the Tools Layer
How DDD aggregates shape the Tools layer: one root per set of tools, one aggregate per transaction, and sagas driven by domain events for anything wider.
Patterns are easy to nod along to and hard to place. The real test of a combined DDD and LVD design is a whole context, from the type definitions at the bottom to the protocol adapters on top, with every file in a folder you can defend. The book walks through one for order management. Here is the same exercise in miniature, set in a community library.
A lending context has one obvious aggregate: the loan. A loan has a root, a few inner entities such as the individual items on it, and rules about how long things may be kept. The business speaks of borrowing, renewing, returning and fines, and the code should say the same.
Here is where each part lands.
LoanOpened and ItemReturned. Every name is one a librarian would use. The invariants live here too, for example that a returned item must carry a return date.The book's order management context follows the same arc, with pricing and total calculations in Utils, a payment gateway translator in Resources, and place-order and confirm-order tools above them. Its closing observation is that each layer contributes exactly its designated concern: pure calculation is isolated at L2, outside access and event publication are delegated to L3, and the Tool handler at L4 orchestrates the overall workflow.
One consequence is worth spelling out. The translation between the vendor's model and the domain model is entirely contained in Resources, so Tool handlers never see it. In our library, if the catalogue vendor renumbers its status codes, one adapter file changes. If the library alters the grace period before fines start, the change lands in a Utils function and perhaps a rule in the schema. Neither change should touch the borrow-item handler, because neither concern belongs to it. The same reasoning works for the order management case in the book: a new payment provider means a new translator in Resources, and the workflow above it carries on as before.
That is the quiet strength of the combined design. A change request can be sorted by its kind, and the kind tells you which layer to open. The book's version of the exercise runs to full listings for every layer; this sketch is only meant to show the shape.
A complete context is not a different architecture from the pieces you have already seen. It is the same few decisions, repeated until every file has an owner: words in Schema, calculations in Utils, outside contact in Resources, workflow in Tools, thin adapters above. For the placement rules see mapping DDD onto the layers, for the handler discipline see aggregates and the Tools layer, and for the translator pattern see keeping external systems at arm's length.