Part 5 of 8 · 1 min read
Nested contexts
Contexts can hold smaller contexts.
Contexts can sit inside contexts. BM uses the phrase "turtles all the way down". At the start, a team finds a few big contexts. The warehouse may later split into order fulfilment, inventory management and goods receiving. These could stay hidden inside one warehouse service boundary, or be promoted to top-level services.
BM gives the deciding factor: the organisation. If three different teams run fulfilment, inventory and goods receiving, they probably each deserve a top-level service. If one team runs all three, the nested form is better. This is Conway's law from pages 3 and 5.
BM gives a second reason for the nested form: testing. A service that uses the warehouse then needs to fake only one coarse interface and not three. A larger test can start all services inside the warehouse and fake everything else.
A worked example (made up). A warehouse has one team of six. Splitting it into three services creates 3 deployments and 3 sets of monitoring for one team. Keeping it as one service with three modules inside keeps 1 deployment. If the company later grows to three teams of six, the modules are already separate and can be promoted to services.
Read it as
Draw big contexts first. Split a big one only when something forces it: a team boundary, a scaling need or a risk. Splitting needs a reason, and "it would be tidy" is not one.
Check yourself: 1. What does BM say should decide between nested and top-level services? 2. How does the nested form help testing? 3. A company has one team for a warehouse with three capabilities. Which form fits?